using Microsoft.Win32;
using SM.core;
using SS;
using SS.core;
using System;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Windows.Forms;
using TVSGPP.doctor;
using TVSGPP.search;
namespace TVSBH.doctor
{
	public class frmPrescription : Form
	{
		private IContainer components = null;
		private GroupBox groupBox3;
		private DataGridView dgvBill;
		private Button btnClose;
		private Button btnDel;
		private Button btnPrint;
		private Button btnSave;
		private Button btnEdit;
		private Button btnAdd;
		private DataGridView dgvProduct;
		private GroupBox groupBox1;
		private Label label2;
		private DateTimePicker txtDate;
		private TextBox txtID;
		private Label label1;
		private Label label3;
		private TextBox txtName;
		private ComboBox cbbSex;
		private Label label5;
		private Label label6;
		private Label label8;
		private TextBox txtAddress;
		private TextBox txtPhone;
		private TextBox txtDoctorGuide;
		private Label label9;
		private Button btnSelect;
		private Button btnAddToBill;
		private TextBox txtProductUnit;
		private TextBox txtProductName;
		private Button btnSearch;
		private TextBox txtDoctor;
		private TextBox txtDesease;
		private ToolTip toolTip1;
		private Button btnFind;
		private ContextMenuStrip cmsBill;
		private ToolStripMenuItem cmsDelProduct;
		private ToolStripSeparator toolStripSeparator1;
		private ToolStripMenuItem cmsAddBill;
		private ToolStripMenuItem cmsEditBill;
		private ToolStripSeparator toolStripSeparator2;
		private ToolStripMenuItem cmsSaveBill;
		private ToolStripMenuItem cmsPrintBill;
		private ToolStripMenuItem cmsDellBill;
		private ToolStripSeparator toolStripSeparator3;
		private ToolStripMenuItem cmsSearchBill;
		private ToolStripMenuItem cmsAddProduct;
		private ToolStripSeparator toolStripSeparator4;
		private Label label17;
		private Button btnSearchTime;
		private DateTimePicker dtpTo;
		private DateTimePicker dtpFrom;
		private Label label26;
		private Label label19;
		private Label label28;
		private Button lblProduct;
		private Button lblMoney;
		private Button lblNumber;
		private Button lblUnit;
		private Label label4;
		private TextBox txtProductGuide;
		private TextBox txtUserGuide;
		private Label label7;
		private NumericUpDown txtAge;
		private ContextMenuStrip ctmBill;
		private ToolStripMenuItem ctmBillAdd;
		private ToolStripMenuItem ctmBillEdit;
		private ToolStripSeparator toolStripSeparator5;
		private ToolStripMenuItem ctmBillPrint;
		private ToolStripMenuItem ctmBillDel;
		private ToolStripSeparator toolStripSeparator6;
		private ToolStripMenuItem ctmBillSearchAdvance;
		private TextBox txtProductNumber1;
		private Button btnTmp;
		private DataGridViewTextBoxColumn billID;
		private DataGridViewTextBoxColumn DateCreate;
		private DataGridViewTextBoxColumn PatientName;
		private DataGridViewTextBoxColumn PatientAge;
		private DataGridViewTextBoxColumn PatientSex;
		private DataGridViewTextBoxColumn PatientAddress;
		private DataGridViewTextBoxColumn PatientPhone;
		private DataGridViewTextBoxColumn Printed;
		private DataGridViewTextBoxColumn doctorID;
		private DataGridViewTextBoxColumn DoctorName;
		private DataGridViewTextBoxColumn Desease;
		private DataGridViewTextBoxColumn PatientID;
		private DataGridViewTextBoxColumn UserGuide;
		private DataGridViewTextBoxColumn DoctorGuide;
		private DataGridViewTextBoxColumn Status;
		private TabControl tabControl1;
		private TabPage tabPage1;
		private TabPage tabPage2;
		private DataGridView dgvProductSale;
		private TextBox txtProductMoney;
		private Button button2;
		private TextBox txtProductPrice;
		private Button button1;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
		private DataGridViewTextBoxColumn ProductNumber1;
		private DataGridViewTextBoxColumn ProductNumberSale;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
		private DataGridViewTextBoxColumn ProductPrice1;
		private DataGridViewTextBoxColumn ProductMoney1;
		private Label lblSpace;
		private Button btnExport;
		private ComboBox cbbWareHouse;
		private DataGridViewTextBoxColumn productName;
		private DataGridViewTextBoxColumn productUnit;
		private DataGridViewTextBoxColumn productNumber;
		private DataGridViewTextBoxColumn ProductID;
		private DataGridViewTextBoxColumn ProductGuide;
		private DataGridViewTextBoxColumn ProductPrice;
		private DataGridViewTextBoxColumn ProductMoney;
		private TextBox txtBalancerAllPacket;
		private Label label10;
		private Func objFunc = new Func();
		public string userName = "";
		public string fullName = "";
		public string currDortorID = "";
		public string currCusID = "0";
		public string currPid = "";
		public string strConnection = "";
		public string tmpUsage = "";
		public string totalMoney = "";
		public string cusID = "";
		private customers objCus = new customers();
		private Account objAccount = new Account();
		private products objProduct = new products();
		private Doctor objDoctor = new Doctor();
		private DataTable objProductTable = new DataTable();
		private DataTable objTable = new DataTable();
		private Bill objBill = new Bill();
		private bool AllowSellSuppen = false;
		private bool checkBalancer = false;
		private bool BasePrice = false;
		private bool allowEditPrice = false;
		private float balancerAllPacket = 0f;
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
			this.components = new Container();
			ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(frmPrescription));
			DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle4 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle5 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle6 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle7 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle8 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle9 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle10 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle11 = new DataGridViewCellStyle();
			this.groupBox3 = new GroupBox();
			this.label17 = new Label();
			this.btnSearchTime = new Button();
			this.dtpTo = new DateTimePicker();
			this.dtpFrom = new DateTimePicker();
			this.dgvBill = new DataGridView();
			this.billID = new DataGridViewTextBoxColumn();
			this.DateCreate = new DataGridViewTextBoxColumn();
			this.PatientName = new DataGridViewTextBoxColumn();
			this.PatientAge = new DataGridViewTextBoxColumn();
			this.PatientSex = new DataGridViewTextBoxColumn();
			this.PatientAddress = new DataGridViewTextBoxColumn();
			this.PatientPhone = new DataGridViewTextBoxColumn();
			this.Printed = new DataGridViewTextBoxColumn();
			this.doctorID = new DataGridViewTextBoxColumn();
			this.DoctorName = new DataGridViewTextBoxColumn();
			this.Desease = new DataGridViewTextBoxColumn();
			this.PatientID = new DataGridViewTextBoxColumn();
			this.UserGuide = new DataGridViewTextBoxColumn();
			this.DoctorGuide = new DataGridViewTextBoxColumn();
			this.Status = new DataGridViewTextBoxColumn();
			this.ctmBill = new ContextMenuStrip(this.components);
			this.ctmBillAdd = new ToolStripMenuItem();
			this.ctmBillEdit = new ToolStripMenuItem();
			this.toolStripSeparator5 = new ToolStripSeparator();
			this.ctmBillPrint = new ToolStripMenuItem();
			this.ctmBillDel = new ToolStripMenuItem();
			this.toolStripSeparator6 = new ToolStripSeparator();
			this.ctmBillSearchAdvance = new ToolStripMenuItem();
			this.btnClose = new Button();
			this.btnDel = new Button();
			this.btnPrint = new Button();
			this.btnSave = new Button();
			this.btnEdit = new Button();
			this.btnAdd = new Button();
			this.dgvProduct = new DataGridView();
			this.productName = new DataGridViewTextBoxColumn();
			this.productUnit = new DataGridViewTextBoxColumn();
			this.productNumber = new DataGridViewTextBoxColumn();
			this.ProductID = new DataGridViewTextBoxColumn();
			this.ProductGuide = new DataGridViewTextBoxColumn();
			this.ProductPrice = new DataGridViewTextBoxColumn();
			this.ProductMoney = new DataGridViewTextBoxColumn();
			this.cmsBill = new ContextMenuStrip(this.components);
			this.cmsAddProduct = new ToolStripMenuItem();
			this.toolStripSeparator4 = new ToolStripSeparator();
			this.cmsDelProduct = new ToolStripMenuItem();
			this.toolStripSeparator1 = new ToolStripSeparator();
			this.cmsAddBill = new ToolStripMenuItem();
			this.cmsEditBill = new ToolStripMenuItem();
			this.toolStripSeparator2 = new ToolStripSeparator();
			this.cmsSaveBill = new ToolStripMenuItem();
			this.cmsPrintBill = new ToolStripMenuItem();
			this.cmsDellBill = new ToolStripMenuItem();
			this.toolStripSeparator3 = new ToolStripSeparator();
			this.cmsSearchBill = new ToolStripMenuItem();
			this.groupBox1 = new GroupBox();
			this.label10 = new Label();
			this.txtAge = new NumericUpDown();
			this.label28 = new Label();
			this.txtDesease = new TextBox();
			this.label19 = new Label();
			this.txtPhone = new TextBox();
			this.label8 = new Label();
			this.txtDoctor = new TextBox();
			this.txtAddress = new TextBox();
			this.label6 = new Label();
			this.label5 = new Label();
			this.cbbSex = new ComboBox();
			this.txtName = new TextBox();
			this.label3 = new Label();
			this.label2 = new Label();
			this.txtDate = new DateTimePicker();
			this.txtID = new TextBox();
			this.label1 = new Label();
			this.btnTmp = new Button();
			this.btnFind = new Button();
			this.txtDoctorGuide = new TextBox();
			this.label9 = new Label();
			this.btnSelect = new Button();
			this.txtProductUnit = new TextBox();
			this.txtProductName = new TextBox();
			this.btnAddToBill = new Button();
			this.btnSearch = new Button();
			this.toolTip1 = new ToolTip(this.components);
			this.dgvProductSale = new DataGridView();
			this.dataGridViewTextBoxColumn1 = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn2 = new DataGridViewTextBoxColumn();
			this.ProductNumber1 = new DataGridViewTextBoxColumn();
			this.ProductNumberSale = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn4 = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn5 = new DataGridViewTextBoxColumn();
			this.ProductPrice1 = new DataGridViewTextBoxColumn();
			this.ProductMoney1 = new DataGridViewTextBoxColumn();
			this.label26 = new Label();
			this.lblProduct = new Button();
			this.lblMoney = new Button();
			this.lblNumber = new Button();
			this.lblUnit = new Button();
			this.label4 = new Label();
			this.txtProductGuide = new TextBox();
			this.txtUserGuide = new TextBox();
			this.label7 = new Label();
			this.txtProductNumber1 = new TextBox();
			this.tabControl1 = new TabControl();
			this.tabPage1 = new TabPage();
			this.txtProductMoney = new TextBox();
			this.button2 = new Button();
			this.txtProductPrice = new TextBox();
			this.button1 = new Button();
			this.tabPage2 = new TabPage();
			this.lblSpace = new Label();
			this.btnExport = new Button();
			this.cbbWareHouse = new ComboBox();
			this.txtBalancerAllPacket = new TextBox();
			this.groupBox3.SuspendLayout();
			((ISupportInitialize)this.dgvBill).BeginInit();
			this.ctmBill.SuspendLayout();
			((ISupportInitialize)this.dgvProduct).BeginInit();
			this.cmsBill.SuspendLayout();
			this.groupBox1.SuspendLayout();
			((ISupportInitialize)this.txtAge).BeginInit();
			((ISupportInitialize)this.dgvProductSale).BeginInit();
			this.tabControl1.SuspendLayout();
			this.tabPage1.SuspendLayout();
			this.tabPage2.SuspendLayout();
			base.SuspendLayout();
			this.groupBox3.Controls.Add(this.label17);
			this.groupBox3.Controls.Add(this.btnSearchTime);
			this.groupBox3.Controls.Add(this.dtpTo);
			this.groupBox3.Controls.Add(this.dtpFrom);
			this.groupBox3.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.groupBox3.Location = new System.Drawing.Point(8, 141);
			this.groupBox3.Name = "groupBox3";
			this.groupBox3.Size = new Size(220, 46);
			this.groupBox3.TabIndex = 42;
			this.groupBox3.TabStop = false;
			this.groupBox3.Text = "Tìm kiếm";
//			this.label17.Image = (Image)componentResourceManager.GetObject("label17.Image");
			this.label17.Location = new System.Drawing.Point(90, 19);
			this.label17.Name = "label17";
			this.label17.Size = new Size(20, 25);
			this.label17.TabIndex = 156;
			this.btnSearchTime.FlatAppearance.BorderColor = Color.FromArgb(0, 192, 192);
			this.btnSearchTime.FlatStyle = FlatStyle.Flat;
			this.btnSearchTime.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			//this.btnSearchTime.Image = (Image)componentResourceManager.GetObject("btnSearchTime.Image");
			this.btnSearchTime.Location = new System.Drawing.Point(196, 21);
			this.btnSearchTime.Name = "btnSearchTime";
			this.btnSearchTime.Size = new Size(21, 21);
			this.btnSearchTime.TabIndex = 155;
			this.btnSearchTime.UseVisualStyleBackColor = true;
			this.btnSearchTime.Click += new EventHandler(this.btnSearchTime_Click);
			this.dtpTo.CustomFormat = "dd/MM/yyyy";
			this.dtpTo.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.dtpTo.Format = DateTimePickerFormat.Custom;
			this.dtpTo.Location = new System.Drawing.Point(109, 21);
			this.dtpTo.Name = "dtpTo";
			this.dtpTo.Size = new Size(86, 21);
			this.dtpTo.TabIndex = 154;
			this.dtpFrom.CustomFormat = "dd/MM/yyyy";
			this.dtpFrom.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.dtpFrom.Format = DateTimePickerFormat.Custom;
			this.dtpFrom.Location = new System.Drawing.Point(3, 21);
			this.dtpFrom.Name = "dtpFrom";
			this.dtpFrom.Size = new Size(86, 21);
			this.dtpFrom.TabIndex = 153;
			this.dgvBill.AllowUserToAddRows = false;
			this.dgvBill.AllowUserToDeleteRows = false;
			this.dgvBill.AllowUserToOrderColumns = true;
			this.dgvBill.AllowUserToResizeColumns = false;
			this.dgvBill.AllowUserToResizeRows = false;
			dataGridViewCellStyle.BackColor = Color.FromArgb(192, 255, 255);
			dataGridViewCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvBill.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle;
			this.dgvBill.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left);
			this.dgvBill.BackgroundColor = Color.White;
			this.dgvBill.BorderStyle = BorderStyle.Fixed3D;
			this.dgvBill.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
			this.dgvBill.Columns.AddRange(new DataGridViewColumn[]
			{
				this.billID,
				this.DateCreate,
				this.PatientName,
				this.PatientAge,
				this.PatientSex,
				this.PatientAddress,
				this.PatientPhone,
				this.Printed,
				this.doctorID,
				this.DoctorName,
				this.Desease,
				this.PatientID,
				this.UserGuide,
				this.DoctorGuide,
				this.Status
			});
			this.dgvBill.ContextMenuStrip = this.ctmBill;
			this.dgvBill.Cursor = Cursors.Hand;
			this.dgvBill.EnableHeadersVisualStyles = false;
			this.dgvBill.Location = new System.Drawing.Point(7, 190);
			this.dgvBill.MultiSelect = false;
			this.dgvBill.Name = "dgvBill";
			this.dgvBill.ReadOnly = true;
			this.dgvBill.RowHeadersVisible = false;
			this.dgvBill.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
			this.dgvBill.RowTemplate.DefaultCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvBill.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
			this.dgvBill.Size = new Size(220, 366);
			this.dgvBill.TabIndex = 41;
			this.dgvBill.RowPrePaint += new DataGridViewRowPrePaintEventHandler(this.dgvBill_RowPrePaint);
			this.dgvBill.CellEnter += new DataGridViewCellEventHandler(this.dgvBill_CellEnter);
			this.billID.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
			this.billID.DataPropertyName = "ID";
			this.billID.HeaderText = "Đơn thuốc";
			this.billID.MinimumWidth = 120;
			this.billID.Name = "billID";
			this.billID.ReadOnly = true;
			this.DateCreate.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.DateCreate.DataPropertyName = "DateCreate";
			dataGridViewCellStyle2.Format = "D";
			dataGridViewCellStyle2.NullValue = null;
			this.DateCreate.DefaultCellStyle = dataGridViewCellStyle2;
			this.DateCreate.HeaderText = "Ngày lập";
			this.DateCreate.MinimumWidth = 88;
			this.DateCreate.Name = "DateCreate";
			this.DateCreate.ReadOnly = true;
			this.DateCreate.Width = 88;
			this.PatientName.DataPropertyName = "PatientName";
			this.PatientName.HeaderText = "Tên khách hàng";
			this.PatientName.Name = "PatientName";
			this.PatientName.ReadOnly = true;
			this.PatientName.Visible = false;
			this.PatientAge.DataPropertyName = "PatientAge";
			this.PatientAge.HeaderText = "Tuổi";
			this.PatientAge.Name = "PatientAge";
			this.PatientAge.ReadOnly = true;
			this.PatientAge.Visible = false;
			this.PatientSex.DataPropertyName = "PatientSex";
			this.PatientSex.HeaderText = "Giới tính";
			this.PatientSex.Name = "PatientSex";
			this.PatientSex.ReadOnly = true;
			this.PatientSex.Visible = false;
			this.PatientAddress.DataPropertyName = "PatientAddress";
			this.PatientAddress.HeaderText = "Địa chỉ";
			this.PatientAddress.Name = "PatientAddress";
			this.PatientAddress.ReadOnly = true;
			this.PatientAddress.Visible = false;
			this.PatientPhone.DataPropertyName = "PatientPhone";
			this.PatientPhone.HeaderText = "Điện thoại";
			this.PatientPhone.Name = "PatientPhone";
			this.PatientPhone.ReadOnly = true;
			this.PatientPhone.Visible = false;
			this.Printed.DataPropertyName = "Printed";
			this.Printed.HeaderText = "Printed";
			this.Printed.Name = "Printed";
			this.Printed.ReadOnly = true;
			this.Printed.Visible = false;
			this.doctorID.DataPropertyName = "doctorID";
			this.doctorID.HeaderText = "_DoctorID";
			this.doctorID.Name = "doctorID";
			this.doctorID.ReadOnly = true;
			this.doctorID.Visible = false;
			this.DoctorName.DataPropertyName = "DoctorName";
			this.DoctorName.HeaderText = "_DoctorName";
			this.DoctorName.Name = "DoctorName";
			this.DoctorName.ReadOnly = true;
			this.DoctorName.Visible = false;
			this.Desease.DataPropertyName = "Desease";
			this.Desease.HeaderText = "Column10";
			this.Desease.Name = "Desease";
			this.Desease.ReadOnly = true;
			this.Desease.Visible = false;
			this.PatientID.DataPropertyName = "PatientID";
			this.PatientID.HeaderText = "Column11";
			this.PatientID.Name = "PatientID";
			this.PatientID.ReadOnly = true;
			this.PatientID.Visible = false;
			this.UserGuide.DataPropertyName = "UserGuide";
			this.UserGuide.HeaderText = "UserGuide";
			this.UserGuide.Name = "UserGuide";
			this.UserGuide.ReadOnly = true;
			this.UserGuide.Visible = false;
			this.DoctorGuide.DataPropertyName = "DoctorGuide";
			this.DoctorGuide.HeaderText = "DoctorGuide";
			this.DoctorGuide.Name = "DoctorGuide";
			this.DoctorGuide.ReadOnly = true;
			this.DoctorGuide.Visible = false;
			this.Status.DataPropertyName = "Status";
			this.Status.HeaderText = "Status";
			this.Status.Name = "Status";
			this.Status.ReadOnly = true;
			this.Status.Visible = false;
			this.ctmBill.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.ctmBill.Items.AddRange(new ToolStripItem[]
			{
				this.ctmBillAdd,
				this.ctmBillEdit,
				this.toolStripSeparator5,
				this.ctmBillPrint,
				this.ctmBillDel,
				this.toolStripSeparator6,
				this.ctmBillSearchAdvance
			});
			this.ctmBill.Name = "ctmBill";
			this.ctmBill.Size = new Size(180, 126);
			this.ctmBillAdd.Name = "ctmBillAdd";
			this.ctmBillAdd.Size = new Size(179, 22);
			this.ctmBillAdd.Text = "Tạo đơn thuốc";
			this.ctmBillAdd.Click += new EventHandler(this.ctmBillAdd_Click);
			this.ctmBillEdit.Name = "ctmBillEdit";
			this.ctmBillEdit.Size = new Size(179, 22);
			this.ctmBillEdit.Text = "Sửa đơn thuốc";
			this.ctmBillEdit.Click += new EventHandler(this.ctmBillEdit_Click);
			this.toolStripSeparator5.Name = "toolStripSeparator5";
			this.toolStripSeparator5.Size = new Size(176, 6);
			this.ctmBillPrint.Name = "ctmBillPrint";
			this.ctmBillPrint.Size = new Size(179, 22);
			this.ctmBillPrint.Text = "In đơn thuốc";
			this.ctmBillPrint.Click += new EventHandler(this.ctmBillPrint_Click);
			this.ctmBillDel.Name = "ctmBillDel";
			this.ctmBillDel.Size = new Size(179, 22);
			this.ctmBillDel.Text = "Xoá đơn thuốc";
			this.ctmBillDel.Click += new EventHandler(this.ctmBillDel_Click);
			this.toolStripSeparator6.Name = "toolStripSeparator6";
			this.toolStripSeparator6.Size = new Size(176, 6);
			this.ctmBillSearchAdvance.Name = "ctmBillSearchAdvance";
			this.ctmBillSearchAdvance.Size = new Size(179, 22);
			this.ctmBillSearchAdvance.Text = "Tìm kiếm nâng cao";
			this.ctmBillSearchAdvance.Click += new EventHandler(this.ctmBillSearchAdvance_Click);
			this.btnClose.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.btnClose.Cursor = Cursors.Hand;
			this.btnClose.FlatAppearance.BorderColor = Color.FromArgb(255, 192, 255);
			this.btnClose.FlatStyle = FlatStyle.Flat;
			this.btnClose.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnClose.Location = new System.Drawing.Point(828, 564);
			this.btnClose.Name = "btnClose";
			this.btnClose.Size = new Size(109, 26);
			this.btnClose.TabIndex = 25;
			this.btnClose.Text = "Thoát  [ ESC ]";
			this.btnClose.UseVisualStyleBackColor = true;
			this.btnClose.Click += new EventHandler(this.btnClose_Click);
			this.btnDel.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.btnDel.Cursor = Cursors.Hand;
			this.btnDel.Enabled = false;
			this.btnDel.FlatAppearance.BorderColor = Color.FromArgb(255, 192, 255);
			this.btnDel.FlatStyle = FlatStyle.Flat;
			this.btnDel.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnDel.Location = new System.Drawing.Point(448, 564);
			this.btnDel.Name = "btnDel";
			this.btnDel.Size = new Size(105, 26);
			this.btnDel.TabIndex = 22;
			this.btnDel.Text = "Xoá đơn [ F8 ]";
			this.btnDel.UseVisualStyleBackColor = true;
			this.btnDel.Click += new EventHandler(this.btnDel_Click);
			this.btnDel.EnabledChanged += new EventHandler(this.btnDel_EnabledChanged);
			this.btnPrint.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.btnPrint.Cursor = Cursors.Hand;
			this.btnPrint.Enabled = false;
			this.btnPrint.FlatAppearance.BorderColor = Color.FromArgb(255, 192, 255);
			this.btnPrint.FlatStyle = FlatStyle.Flat;
			this.btnPrint.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnPrint.Location = new System.Drawing.Point(339, 564);
			this.btnPrint.Name = "btnPrint";
			this.btnPrint.Size = new Size(105, 26);
			this.btnPrint.TabIndex = 21;
			this.btnPrint.Text = "Xem và in [ F7 ]";
			this.btnPrint.UseVisualStyleBackColor = true;
			this.btnPrint.Click += new EventHandler(this.btnPrint_Click);
			this.btnPrint.EnabledChanged += new EventHandler(this.btnPrint_EnabledChanged);
			this.btnSave.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.btnSave.Cursor = Cursors.Hand;
			this.btnSave.Enabled = false;
			this.btnSave.FlatAppearance.BorderColor = Color.FromArgb(255, 192, 255);
			this.btnSave.FlatStyle = FlatStyle.Flat;
			this.btnSave.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnSave.Location = new System.Drawing.Point(230, 564);
			this.btnSave.Name = "btnSave";
			this.btnSave.Size = new Size(105, 26);
			this.btnSave.TabIndex = 20;
			this.btnSave.Text = "Lưu đơn [ F6 ]";
			this.btnSave.UseVisualStyleBackColor = true;
			this.btnSave.Click += new EventHandler(this.btnSave_Click);
			this.btnSave.EnabledChanged += new EventHandler(this.btnSave_EnabledChanged);
			this.btnEdit.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.btnEdit.Cursor = Cursors.Hand;
			this.btnEdit.Enabled = false;
			this.btnEdit.FlatAppearance.BorderColor = Color.FromArgb(255, 192, 255);
			this.btnEdit.FlatStyle = FlatStyle.Flat;
			this.btnEdit.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnEdit.Location = new System.Drawing.Point(121, 564);
			this.btnEdit.Name = "btnEdit";
			this.btnEdit.Size = new Size(105, 26);
			this.btnEdit.TabIndex = 24;
			this.btnEdit.Text = "Sửa đơn [ F5 ]";
			this.btnEdit.UseVisualStyleBackColor = true;
			this.btnEdit.Click += new EventHandler(this.btnEdit_Click);
			this.btnAdd.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.btnAdd.Cursor = Cursors.Hand;
			this.btnAdd.FlatAppearance.BorderColor = Color.FromArgb(255, 192, 255);
			this.btnAdd.FlatStyle = FlatStyle.Flat;
			this.btnAdd.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnAdd.Location = new System.Drawing.Point(12, 564);
			this.btnAdd.Name = "btnAdd";
			this.btnAdd.Size = new Size(105, 26);
			this.btnAdd.TabIndex = 1;
			this.btnAdd.Text = "Thêm mới [ F4 ]";
			this.btnAdd.UseVisualStyleBackColor = true;
			this.btnAdd.Click += new EventHandler(this.btnAdd_Click);
			this.dgvProduct.AllowUserToAddRows = false;
			this.dgvProduct.AllowUserToDeleteRows = false;
			this.dgvProduct.AllowUserToOrderColumns = true;
			this.dgvProduct.AllowUserToResizeColumns = false;
			this.dgvProduct.AllowUserToResizeRows = false;
			dataGridViewCellStyle3.BackColor = Color.White;
			dataGridViewCellStyle3.Font = new Font("Arial", 9.75f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
			this.dgvProduct.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.dgvProduct.BackgroundColor = Color.White;
			this.dgvProduct.BorderStyle = BorderStyle.Fixed3D;
			this.dgvProduct.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
			this.dgvProduct.ColumnHeadersVisible = false;
			this.dgvProduct.Columns.AddRange(new DataGridViewColumn[]
			{
				this.productName,
				this.productUnit,
				this.productNumber,
				this.ProductID,
				this.ProductGuide,
				this.ProductPrice,
				this.ProductMoney
			});
			this.dgvProduct.ContextMenuStrip = this.cmsBill;
			this.dgvProduct.Cursor = Cursors.Hand;
			this.dgvProduct.EnableHeadersVisualStyles = false;
			this.dgvProduct.Location = new System.Drawing.Point(2, 47);
			this.dgvProduct.MultiSelect = false;
			this.dgvProduct.Name = "dgvProduct";
			this.dgvProduct.ReadOnly = true;
			this.dgvProduct.RowHeadersVisible = false;
			this.dgvProduct.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
			this.dgvProduct.RowTemplate.DefaultCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.dgvProduct.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
			this.dgvProduct.Size = new Size(675, 322);
			this.dgvProduct.TabIndex = 16;
			this.toolTip1.SetToolTip(this.dgvProduct, "Bấm nút phải chuột để chọn\r\nmenu thao tác nhanh !");
			this.dgvProduct.KeyDown += new KeyEventHandler(this.dgvProduct_KeyDown);
			this.dgvProduct.CellEnter += new DataGridViewCellEventHandler(this.dgvProduct_CellEnter);
			this.productName.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.productName.DataPropertyName = "productName";
			this.productName.HeaderText = "Sản phẩm";
			this.productName.MinimumWidth = 196;
			this.productName.Name = "productName";
			this.productName.ReadOnly = true;
			this.productName.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.productName.Width = 196;
			this.productUnit.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.productUnit.DataPropertyName = "productUnit";
			this.productUnit.HeaderText = "Đơn vị tính";
			this.productUnit.MinimumWidth = 90;
			this.productUnit.Name = "productUnit";
			this.productUnit.ReadOnly = true;
			this.productUnit.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.productUnit.Width = 90;
			this.productNumber.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.productNumber.DataPropertyName = "productNumber";
			dataGridViewCellStyle4.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle4.Format = "N0";
			dataGridViewCellStyle4.NullValue = null;
			this.productNumber.DefaultCellStyle = dataGridViewCellStyle4;
			this.productNumber.HeaderText = "Số lượng";
			this.productNumber.MinimumWidth = 92;
			this.productNumber.Name = "productNumber";
			this.productNumber.ReadOnly = true;
			this.productNumber.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.productNumber.Width = 92;
			this.ProductID.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.ProductID.DataPropertyName = "ProductID";
			this.ProductID.HeaderText = "Mã sản phẩm";
			this.ProductID.Name = "ProductID";
			this.ProductID.ReadOnly = true;
			this.ProductID.Visible = false;
			this.ProductGuide.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
			this.ProductGuide.DataPropertyName = "ProductGuide";
			this.ProductGuide.HeaderText = "Liều dùng";
			this.ProductGuide.MinimumWidth = 100;
			this.ProductGuide.Name = "ProductGuide";
			this.ProductGuide.ReadOnly = true;
			this.ProductPrice.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.ProductPrice.DataPropertyName = "ProductPrice";
			dataGridViewCellStyle5.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle5.Format = "N2";
			dataGridViewCellStyle5.NullValue = "0";
			this.ProductPrice.DefaultCellStyle = dataGridViewCellStyle5;
			this.ProductPrice.HeaderText = "Đơn giá";
			this.ProductPrice.MinimumWidth = 91;
			this.ProductPrice.Name = "ProductPrice";
			this.ProductPrice.ReadOnly = true;
			this.ProductPrice.Width = 91;
			this.ProductMoney.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.ProductMoney.DataPropertyName = "ProductMoney";
			dataGridViewCellStyle6.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle6.Format = "N2";
			dataGridViewCellStyle6.NullValue = "0";
			this.ProductMoney.DefaultCellStyle = dataGridViewCellStyle6;
			this.ProductMoney.HeaderText = "Thành tiền";
			this.ProductMoney.MinimumWidth = 100;
			this.ProductMoney.Name = "ProductMoney";
			this.ProductMoney.ReadOnly = true;
			this.cmsBill.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.cmsBill.Items.AddRange(new ToolStripItem[]
			{
				this.cmsAddProduct,
				this.toolStripSeparator4,
				this.cmsDelProduct,
				this.toolStripSeparator1,
				this.cmsAddBill,
				this.cmsEditBill,
				this.toolStripSeparator2,
				this.cmsSaveBill,
				this.cmsPrintBill,
				this.cmsDellBill,
				this.toolStripSeparator3,
				this.cmsSearchBill
			});
			this.cmsBill.Name = "cmsBill";
			this.cmsBill.Size = new Size(239, 204);
			this.cmsAddProduct.Name = "cmsAddProduct";
			this.cmsAddProduct.Size = new Size(238, 22);
			this.cmsAddProduct.Text = "Thêm thuốc vào đơn";
			this.cmsAddProduct.Click += new EventHandler(this.btnSelect_Click);
			this.toolStripSeparator4.Name = "toolStripSeparator4";
			this.toolStripSeparator4.Size = new Size(235, 6);
			this.cmsDelProduct.Name = "cmsDelProduct";
			this.cmsDelProduct.ShortcutKeys = Keys.Delete;
			this.cmsDelProduct.Size = new Size(238, 22);
			this.cmsDelProduct.Text = "Xoá thuốc khỏi đơn thuốc";
			this.cmsDelProduct.Click += new EventHandler(this.cmsDelProduct_Click);
			this.toolStripSeparator1.Name = "toolStripSeparator1";
			this.toolStripSeparator1.Size = new Size(235, 6);
			this.cmsAddBill.Name = "cmsAddBill";
			this.cmsAddBill.Size = new Size(238, 22);
			this.cmsAddBill.Text = "Tạo đơn thuốc";
			this.cmsAddBill.Click += new EventHandler(this.cmsAddBill_Click);
			this.cmsEditBill.Name = "cmsEditBill";
			this.cmsEditBill.Size = new Size(238, 22);
			this.cmsEditBill.Text = "Sửa đơn thuốc";
			this.cmsEditBill.Click += new EventHandler(this.cmsEditBill_Click);
			this.toolStripSeparator2.Name = "toolStripSeparator2";
			this.toolStripSeparator2.Size = new Size(235, 6);
			this.cmsSaveBill.Enabled = false;
			this.cmsSaveBill.Name = "cmsSaveBill";
			this.cmsSaveBill.Size = new Size(238, 22);
			this.cmsSaveBill.Text = "Lưu đơn thuốc";
			this.cmsSaveBill.Click += new EventHandler(this.cmsSaveBill_Click);
			this.cmsPrintBill.Enabled = false;
			this.cmsPrintBill.Name = "cmsPrintBill";
			this.cmsPrintBill.Size = new Size(238, 22);
			this.cmsPrintBill.Text = "In đơn thuốc";
			this.cmsPrintBill.Click += new EventHandler(this.cmsPrintBill_Click);
			this.cmsDellBill.Enabled = false;
			this.cmsDellBill.Name = "cmsDellBill";
			this.cmsDellBill.Size = new Size(238, 22);
			this.cmsDellBill.Text = "Xoá đơn thuốc";
			this.cmsDellBill.Click += new EventHandler(this.cmsDellBill_Click);
			this.toolStripSeparator3.Name = "toolStripSeparator3";
			this.toolStripSeparator3.Size = new Size(235, 6);
			this.cmsSearchBill.Name = "cmsSearchBill";
			this.cmsSearchBill.Size = new Size(238, 22);
			this.cmsSearchBill.Text = "Tìm kiếm nâng cao";
			this.cmsSearchBill.Click += new EventHandler(this.cmsSearchBill_Click);
			this.groupBox1.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.groupBox1.Controls.Add(this.label10);
			this.groupBox1.Controls.Add(this.txtAge);
			this.groupBox1.Controls.Add(this.label28);
			this.groupBox1.Controls.Add(this.txtDesease);
			this.groupBox1.Controls.Add(this.label19);
			this.groupBox1.Controls.Add(this.txtPhone);
			this.groupBox1.Controls.Add(this.label8);
			this.groupBox1.Controls.Add(this.txtDoctor);
			this.groupBox1.Controls.Add(this.txtAddress);
			this.groupBox1.Controls.Add(this.label6);
			this.groupBox1.Controls.Add(this.label5);
			this.groupBox1.Controls.Add(this.cbbSex);
			this.groupBox1.Controls.Add(this.txtName);
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.Controls.Add(this.txtDate);
			this.groupBox1.Controls.Add(this.txtID);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Controls.Add(this.btnTmp);
			this.groupBox1.Controls.Add(this.btnFind);
			this.groupBox1.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.groupBox1.Location = new System.Drawing.Point(7, 5);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new Size(936, 106);
			this.groupBox1.TabIndex = 0;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "Thông tin đơn thuốc";
			this.label10.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.label10.AutoSize = true;
			this.label10.BackColor = SystemColors.ButtonFace;
			this.label10.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label10.Location = new System.Drawing.Point(827, 20);
			this.label10.Name = "label10";
			this.label10.Size = new Size(11, 15);
			this.label10.TabIndex = 48;
			this.label10.Text = "-";
			this.label10.TextAlign = ContentAlignment.MiddleRight;
			this.txtAge.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.txtAge.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.txtAge.Location = new System.Drawing.Point(757, 18);
            //NumericUpDown arg_26F6_0 = this.txtAge;
			int[] array = new int[4];
			array[0] = 200;
            txtAge.Maximum = new decimal(array);
			this.txtAge.Name = "txtAge";
			this.txtAge.Size = new Size(60, 22);
			this.txtAge.TabIndex = 4;
			this.txtAge.TextAlign = HorizontalAlignment.Center;
			this.txtAge.Leave += new EventHandler(this.txtAge_Leave);
			this.txtAge.KeyPress += new KeyPressEventHandler(this.txtAge_KeyPress);
			this.txtAge.Enter += new EventHandler(this.txtAge_Enter);
			this.label28.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.label28.AutoSize = true;
			this.label28.BackColor = SystemColors.ButtonFace;
			this.label28.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label28.Location = new System.Drawing.Point(706, 73);
			this.label28.Name = "label28";
			this.label28.Size = new Size(48, 15);
			this.label28.TabIndex = 47;
			this.label28.Text = "Bác sĩ :";
			this.label28.TextAlign = ContentAlignment.MiddleRight;
			this.txtDesease.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.txtDesease.BackColor = Color.White;
			this.txtDesease.Font = new Font("Arial", 9.75f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.txtDesease.Location = new System.Drawing.Point(90, 70);
			this.txtDesease.Name = "txtDesease";
			this.txtDesease.ReadOnly = true;
			this.txtDesease.Size = new Size(591, 22);
			this.txtDesease.TabIndex = 8;
			this.txtDesease.DoubleClick += new EventHandler(this.txtDesease_DoubleClick);
			this.txtDesease.Leave += new EventHandler(this.txtDesease_Leave);
			this.txtDesease.KeyPress += new KeyPressEventHandler(this.txtDesease_KeyPress);
			this.txtDesease.Enter += new EventHandler(this.txtDesease_Enter);
			this.label19.AutoSize = true;
			this.label19.BackColor = SystemColors.ButtonFace;
			this.label19.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label19.Location = new System.Drawing.Point(7, 73);
			this.label19.Name = "label19";
			this.label19.Size = new Size(80, 15);
			this.label19.TabIndex = 45;
			this.label19.Text = "Chuẩn đoán :";
			this.label19.TextAlign = ContentAlignment.MiddleRight;
			this.txtPhone.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.txtPhone.BackColor = Color.White;
			this.txtPhone.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtPhone.Location = new System.Drawing.Point(757, 44);
			this.txtPhone.Name = "txtPhone";
			this.txtPhone.ReadOnly = true;
			this.txtPhone.Size = new Size(173, 22);
			this.txtPhone.TabIndex = 7;
			this.txtPhone.Leave += new EventHandler(this.txtPhone_Leave);
			this.txtPhone.KeyPress += new KeyPressEventHandler(this.txtPhone_KeyPress);
			this.txtPhone.Enter += new EventHandler(this.txtPhone_Enter);
			this.label8.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.label8.AutoSize = true;
			this.label8.BackColor = SystemColors.ButtonFace;
			this.label8.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label8.Location = new System.Drawing.Point(684, 47);
			this.label8.Name = "label8";
			this.label8.Size = new Size(70, 15);
			this.label8.TabIndex = 30;
			this.label8.Text = "Điện thoại :";
			this.label8.TextAlign = ContentAlignment.MiddleRight;
			this.txtDoctor.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.txtDoctor.BackColor = Color.White;
			this.txtDoctor.Font = new Font("Arial", 9.75f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.txtDoctor.Location = new System.Drawing.Point(757, 70);
			this.txtDoctor.Name = "txtDoctor";
			this.txtDoctor.ReadOnly = true;
			this.txtDoctor.Size = new Size(173, 22);
			this.txtDoctor.TabIndex = 10;
			this.txtDoctor.Leave += new EventHandler(this.txtDoctor_Leave);
			this.txtDoctor.KeyPress += new KeyPressEventHandler(this.txtDoctor_KeyPress);
			this.txtDoctor.Enter += new EventHandler(this.txtDoctor_Enter);
			this.txtAddress.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.txtAddress.BackColor = Color.White;
			this.txtAddress.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtAddress.Location = new System.Drawing.Point(270, 44);
			this.txtAddress.Name = "txtAddress";
			this.txtAddress.ReadOnly = true;
			this.txtAddress.Size = new Size(411, 22);
			this.txtAddress.TabIndex = 6;
			this.txtAddress.Leave += new EventHandler(this.txtAddress_Leave);
			this.txtAddress.KeyPress += new KeyPressEventHandler(this.txtAddress_KeyPress);
			this.txtAddress.Enter += new EventHandler(this.txtAddress_Enter);
			this.label6.AutoSize = true;
			this.label6.BackColor = SystemColors.ButtonFace;
			this.label6.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label6.Location = new System.Drawing.Point(215, 47);
			this.label6.Name = "label6";
			this.label6.Size = new Size(52, 15);
			this.label6.TabIndex = 28;
			this.label6.Text = "Địa chỉ :";
			this.label6.TextAlign = ContentAlignment.MiddleRight;
			this.label5.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.label5.AutoSize = true;
			this.label5.BackColor = SystemColors.ButtonFace;
			this.label5.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label5.Location = new System.Drawing.Point(693, 21);
			this.label5.Name = "label5";
			this.label5.Size = new Size(61, 15);
			this.label5.TabIndex = 26;
			this.label5.Text = "Tuổi - GT :";
			this.label5.TextAlign = ContentAlignment.MiddleRight;
			this.cbbSex.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.cbbSex.BackColor = Color.White;
			this.cbbSex.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbbSex.FlatStyle = FlatStyle.Flat;
			this.cbbSex.Font = new Font("Arial", 7.5f);
			this.cbbSex.FormattingEnabled = true;
			this.cbbSex.Items.AddRange(new object[]
			{
				"NAM",
				"NỮ"
			});
			this.cbbSex.Location = new System.Drawing.Point(851, 17);
			this.cbbSex.Name = "cbbSex";
			this.cbbSex.Size = new Size(75, 21);
			this.cbbSex.TabIndex = 5;
			this.cbbSex.KeyPress += new KeyPressEventHandler(this.cbbSex_KeyPress);
			this.txtName.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.txtName.BackColor = Color.White;
			this.txtName.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtName.Location = new System.Drawing.Point(270, 18);
			this.txtName.Name = "txtName";
			this.txtName.ReadOnly = true;
			this.txtName.Size = new Size(411, 22);
			this.txtName.TabIndex = 3;
			this.txtName.DoubleClick += new EventHandler(this.txtName_DoubleClick);
			this.txtName.Leave += new EventHandler(this.txtName_Leave);
			this.txtName.KeyPress += new KeyPressEventHandler(this.txtName_KeyPress);
			this.txtName.Enter += new EventHandler(this.txtName_Enter);
			this.label3.AutoSize = true;
			this.label3.BackColor = SystemColors.ButtonFace;
			this.label3.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label3.Location = new System.Drawing.Point(194, 21);
			this.label3.Name = "label3";
			this.label3.Size = new Size(73, 15);
			this.label3.TabIndex = 22;
			this.label3.Text = "Bệnh nhân :";
			this.label3.TextAlign = ContentAlignment.MiddleRight;
			this.label2.AutoSize = true;
			this.label2.BackColor = SystemColors.ButtonFace;
			this.label2.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label2.Location = new System.Drawing.Point(29, 47);
			this.label2.Name = "label2";
			this.label2.Size = new Size(58, 15);
			this.label2.TabIndex = 19;
			this.label2.Text = "Ngày kê :";
			this.label2.TextAlign = ContentAlignment.MiddleRight;
			this.txtDate.CustomFormat = "dd/MM/yyyy";
			this.txtDate.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtDate.Format = DateTimePickerFormat.Custom;
			this.txtDate.Location = new System.Drawing.Point(90, 44);
			this.txtDate.Name = "txtDate";
			this.txtDate.Size = new Size(100, 22);
			this.txtDate.TabIndex = 2;
			this.txtDate.KeyPress += new KeyPressEventHandler(this.txtDate_KeyPress);
			this.txtID.BackColor = Color.White;
			this.txtID.CharacterCasing = CharacterCasing.Upper;
			this.txtID.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtID.Location = new System.Drawing.Point(90, 18);
			this.txtID.Name = "txtID";
			this.txtID.ReadOnly = true;
			this.txtID.Size = new Size(100, 22);
			this.txtID.TabIndex = 1;
			this.txtID.Leave += new EventHandler(this.txtID_Leave);
			this.txtID.KeyPress += new KeyPressEventHandler(this.txtID_KeyPress);
			this.txtID.Enter += new EventHandler(this.txtID_Enter);
			this.label1.AutoSize = true;
			this.label1.BackColor = SystemColors.ButtonFace;
			this.label1.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label1.Location = new System.Drawing.Point(14, 21);
			this.label1.Name = "label1";
			this.label1.Size = new Size(73, 15);
			this.label1.TabIndex = 16;
			this.label1.Text = "Đơn thuốc :";
			this.label1.TextAlign = ContentAlignment.MiddleRight;
			this.btnTmp.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.btnTmp.BackColor = SystemColors.Control;
			this.btnTmp.Enabled = false;
			this.btnTmp.FlatAppearance.BorderColor = Color.FromArgb(192, 255, 255);
			this.btnTmp.FlatAppearance.BorderSize = 0;
			this.btnTmp.FlatStyle = FlatStyle.Flat;
//			this.btnTmp.Image = (Image)componentResourceManager.GetObject("btnTmp.Image");
			this.btnTmp.ImageAlign = ContentAlignment.MiddleLeft;
			this.btnTmp.Location = new System.Drawing.Point(559, 73);
			this.btnTmp.Name = "btnTmp";
			this.btnTmp.Size = new Size(20, 16);
			this.btnTmp.TabIndex = 9;
			this.btnTmp.Text = " Đơn thuốc";
			this.btnTmp.TextAlign = ContentAlignment.MiddleRight;
			this.toolTip1.SetToolTip(this.btnTmp, "Chọn đơn thuốc theo chuẩn bệnh");
			this.btnTmp.UseVisualStyleBackColor = false;
			this.btnTmp.Click += new EventHandler(this.btnTmp_Click);
			this.btnFind.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.btnFind.BackColor = Color.White;
			this.btnFind.Enabled = false;
			this.btnFind.FlatAppearance.BorderColor = Color.FromArgb(192, 255, 255);
			this.btnFind.FlatAppearance.BorderSize = 0;
			this.btnFind.FlatStyle = FlatStyle.Flat;
//			this.btnFind.Image = (Image)componentResourceManager.GetObject("btnFind.Image");
			this.btnFind.Location = new System.Drawing.Point(659, 21);
			this.btnFind.Name = "btnFind";
			this.btnFind.Size = new Size(16, 16);
			this.btnFind.TabIndex = 36;
			this.toolTip1.SetToolTip(this.btnFind, "Chọn bệnh nhân từ danh sách");
			this.btnFind.UseVisualStyleBackColor = false;
			this.btnFind.Click += new EventHandler(this.btnFind_Click);
			this.txtDoctorGuide.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.txtDoctorGuide.BackColor = Color.White;
			this.txtDoctorGuide.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtDoctorGuide.Location = new System.Drawing.Point(140, 401);
			this.txtDoctorGuide.Name = "txtDoctorGuide";
			this.txtDoctorGuide.ReadOnly = true;
			this.txtDoctorGuide.Size = new Size(537, 22);
			this.txtDoctorGuide.TabIndex = 18;
			this.txtDoctorGuide.Leave += new EventHandler(this.txtNote_Leave);
			this.txtDoctorGuide.KeyPress += new KeyPressEventHandler(this.txtNote_KeyPress);
			this.txtDoctorGuide.Enter += new EventHandler(this.txtNote_Enter);
			this.label9.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.label9.AutoSize = true;
			this.label9.BackColor = Color.White;
			this.label9.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.label9.Location = new System.Drawing.Point(9, 404);
			this.label9.Name = "label9";
			this.label9.Size = new Size(128, 15);
			this.label9.TabIndex = 32;
			this.label9.Text = "Nhận xét của Bác sỹ :";
			this.btnSelect.BackColor = Color.White;
			this.btnSelect.Enabled = false;
			this.btnSelect.FlatAppearance.BorderColor = Color.Cyan;
			this.btnSelect.FlatStyle = FlatStyle.Flat;
//			this.btnSelect.Image = (Image)componentResourceManager.GetObject("btnSelect.Image");
			this.btnSelect.Location = new System.Drawing.Point(173, 27);
			this.btnSelect.Name = "btnSelect";
			this.btnSelect.Size = new Size(22, 16);
			this.btnSelect.TabIndex = 12;
			this.toolTip1.SetToolTip(this.btnSelect, "Chọn sản phẩm cần xuất");
			this.btnSelect.UseVisualStyleBackColor = false;
			this.btnSelect.Click += new EventHandler(this.btnSelect_Click);
			this.txtProductUnit.BackColor = Color.White;
			this.txtProductUnit.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtProductUnit.Location = new System.Drawing.Point(199, 24);
			this.txtProductUnit.Name = "txtProductUnit";
			this.txtProductUnit.ReadOnly = true;
			this.txtProductUnit.Size = new Size(90, 22);
			this.txtProductUnit.TabIndex = 13;
			this.txtProductUnit.TextChanged += new EventHandler(this.txtProductUnit_TextChanged);
			this.txtProductUnit.Leave += new EventHandler(this.txtProductUnit_Leave);
			this.txtProductUnit.KeyPress += new KeyPressEventHandler(this.txtProductUnit_KeyPress);
			this.txtProductUnit.Enter += new EventHandler(this.txtProductUnit_Enter);
			this.txtProductName.BackColor = Color.White;
			this.txtProductName.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtProductName.Location = new System.Drawing.Point(2, 24);
			this.txtProductName.Name = "txtProductName";
			this.txtProductName.Size = new Size(196, 22);
			this.txtProductName.TabIndex = 11;
			this.txtProductName.TextChanged += new EventHandler(this.txtProductName_TextChanged);
			this.txtProductName.KeyDown += new KeyEventHandler(this.txtProductName_KeyDown);
			this.txtProductName.Leave += new EventHandler(this.txtProductName_Leave);
			this.txtProductName.KeyPress += new KeyPressEventHandler(this.txtProductName_KeyPress);
			this.txtProductName.Enter += new EventHandler(this.txtProductName_Enter);
			this.btnAddToBill.BackColor = Color.White;
			this.btnAddToBill.Enabled = false;
			this.btnAddToBill.FlatAppearance.BorderColor = Color.FromArgb(192, 255, 255);
			this.btnAddToBill.FlatStyle = FlatStyle.Flat;
			this.btnAddToBill.Location = new System.Drawing.Point(12, 967);
			this.btnAddToBill.Name = "btnAddToBill";
			this.btnAddToBill.Size = new Size(140, 26);
			this.btnAddToBill.TabIndex = 200;
			this.btnAddToBill.Text = "Thêm sản phẩm  [ F3 ]";
			this.btnAddToBill.UseVisualStyleBackColor = false;
			this.btnAddToBill.Click += new EventHandler(this.btnAddToBill_Click);
			this.btnSearch.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.btnSearch.Cursor = Cursors.Hand;
			this.btnSearch.FlatAppearance.BorderColor = Color.FromArgb(255, 192, 255);
			this.btnSearch.FlatStyle = FlatStyle.Flat;
			this.btnSearch.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnSearch.Location = new System.Drawing.Point(557, 564);
			this.btnSearch.Name = "btnSearch";
			this.btnSearch.Size = new Size(105, 26);
			this.btnSearch.TabIndex = 23;
			this.btnSearch.Text = "Tìm kiếm [ F9 ]";
			this.btnSearch.UseVisualStyleBackColor = true;
			this.btnSearch.Click += new EventHandler(this.btnSearch_Click);
			this.toolTip1.IsBalloon = true;
			this.dgvProductSale.AllowUserToAddRows = false;
			this.dgvProductSale.AllowUserToDeleteRows = false;
			this.dgvProductSale.AllowUserToOrderColumns = true;
			this.dgvProductSale.AllowUserToResizeColumns = false;
			this.dgvProductSale.AllowUserToResizeRows = false;
			dataGridViewCellStyle7.BackColor = Color.White;
			dataGridViewCellStyle7.Font = new Font("Arial", 9.75f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.dgvProductSale.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7;
			this.dgvProductSale.BackgroundColor = Color.White;
			this.dgvProductSale.BorderStyle = BorderStyle.Fixed3D;
			this.dgvProductSale.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
			this.dgvProductSale.Columns.AddRange(new DataGridViewColumn[]
			{
				this.dataGridViewTextBoxColumn1,
				this.dataGridViewTextBoxColumn2,
				this.ProductNumber1,
				this.ProductNumberSale,
				this.dataGridViewTextBoxColumn4,
				this.dataGridViewTextBoxColumn5,
				this.ProductPrice1,
				this.ProductMoney1
			});
			this.dgvProductSale.ContextMenuStrip = this.cmsBill;
			this.dgvProductSale.Cursor = Cursors.Hand;
			this.dgvProductSale.Dock = DockStyle.Fill;
			this.dgvProductSale.EnableHeadersVisualStyles = false;
			this.dgvProductSale.Location = new System.Drawing.Point(3, 3);
			this.dgvProductSale.MultiSelect = false;
			this.dgvProductSale.Name = "dgvProductSale";
			this.dgvProductSale.ReadOnly = true;
			this.dgvProductSale.RowHeadersVisible = false;
			this.dgvProductSale.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
			this.dgvProductSale.RowTemplate.DefaultCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.dgvProductSale.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
			this.dgvProductSale.Size = new Size(676, 417);
			this.dgvProductSale.TabIndex = 17;
			this.toolTip1.SetToolTip(this.dgvProductSale, "Bấm nút phải chuột để chọn\r\nmenu thao tác nhanh !");
			this.dgvProductSale.RowPrePaint += new DataGridViewRowPrePaintEventHandler(this.dgvProductSale_RowPrePaint);
			this.dataGridViewTextBoxColumn1.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn1.DataPropertyName = "productName";
			this.dataGridViewTextBoxColumn1.HeaderText = "Tên thuốc";
			this.dataGridViewTextBoxColumn1.MinimumWidth = 200;
			this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
			this.dataGridViewTextBoxColumn1.ReadOnly = true;
			this.dataGridViewTextBoxColumn1.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.dataGridViewTextBoxColumn1.Width = 200;
			this.dataGridViewTextBoxColumn2.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn2.DataPropertyName = "productUnit";
			this.dataGridViewTextBoxColumn2.HeaderText = "Đơn vị tính";
			this.dataGridViewTextBoxColumn2.MinimumWidth = 110;
			this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
			this.dataGridViewTextBoxColumn2.ReadOnly = true;
			this.dataGridViewTextBoxColumn2.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.dataGridViewTextBoxColumn2.Width = 110;
			this.ProductNumber1.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.ProductNumber1.DataPropertyName = "productNumber";
			dataGridViewCellStyle8.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle8.Format = "N0";
			dataGridViewCellStyle8.NullValue = "0";
			this.ProductNumber1.DefaultCellStyle = dataGridViewCellStyle8;
			this.ProductNumber1.HeaderText = "Số lượng kê";
			this.ProductNumber1.MinimumWidth = 92;
			this.ProductNumber1.Name = "ProductNumber1";
			this.ProductNumber1.ReadOnly = true;
			this.ProductNumber1.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.ProductNumber1.Width = 92;
			this.ProductNumberSale.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.ProductNumberSale.DataPropertyName = "ProductNumberSale";
			dataGridViewCellStyle9.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle9.Format = "N0";
			dataGridViewCellStyle9.NullValue = "0";
			this.ProductNumberSale.DefaultCellStyle = dataGridViewCellStyle9;
			this.ProductNumberSale.HeaderText = "Số lượng bán";
			this.ProductNumberSale.MinimumWidth = 100;
			this.ProductNumberSale.Name = "ProductNumberSale";
			this.ProductNumberSale.ReadOnly = true;
			this.ProductNumberSale.SortMode = DataGridViewColumnSortMode.NotSortable;
			this.dataGridViewTextBoxColumn4.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn4.DataPropertyName = "ProductID";
			this.dataGridViewTextBoxColumn4.HeaderText = "Mã sản phẩm";
			this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
			this.dataGridViewTextBoxColumn4.ReadOnly = true;
			this.dataGridViewTextBoxColumn4.Visible = false;
			this.dataGridViewTextBoxColumn5.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
			this.dataGridViewTextBoxColumn5.DataPropertyName = "ProductGuide";
			this.dataGridViewTextBoxColumn5.HeaderText = "Liều dùng";
			this.dataGridViewTextBoxColumn5.MinimumWidth = 100;
			this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
			this.dataGridViewTextBoxColumn5.ReadOnly = true;
			this.ProductPrice1.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.ProductPrice1.DataPropertyName = "ProductPrice";
			dataGridViewCellStyle10.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle10.Format = "N2";
			dataGridViewCellStyle10.NullValue = "0";
			this.ProductPrice1.DefaultCellStyle = dataGridViewCellStyle10;
			this.ProductPrice1.HeaderText = "Đơn giá";
			this.ProductPrice1.MinimumWidth = 91;
			this.ProductPrice1.Name = "ProductPrice1";
			this.ProductPrice1.ReadOnly = true;
			this.ProductPrice1.Width = 91;
			this.ProductMoney1.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.ProductMoney1.DataPropertyName = "ProductMoney";
			dataGridViewCellStyle11.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle11.Format = "N2";
			dataGridViewCellStyle11.NullValue = "0";
			this.ProductMoney1.DefaultCellStyle = dataGridViewCellStyle11;
			this.ProductMoney1.HeaderText = "Thành tiền";
			this.ProductMoney1.MinimumWidth = 100;
			this.ProductMoney1.Name = "ProductMoney1";
			this.ProductMoney1.ReadOnly = true;
			this.label26.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.label26.BackColor = Color.White;
			this.label26.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.label26.Location = new System.Drawing.Point(2, 374);
			this.label26.Name = "label26";
			this.label26.Size = new Size(678, 53);
			this.label26.TabIndex = 90;
			this.lblProduct.BackColor = Color.Gainsboro;
			this.lblProduct.Enabled = false;
			this.lblProduct.FlatAppearance.BorderSize = 0;
			this.lblProduct.FlatStyle = FlatStyle.Flat;
			this.lblProduct.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.lblProduct.Location = new System.Drawing.Point(2, 2);
			this.lblProduct.Name = "lblProduct";
			this.lblProduct.Size = new Size(196, 20);
			this.lblProduct.TabIndex = 178;
			this.lblProduct.Text = "TÊN THUỐC";
			this.lblProduct.UseVisualStyleBackColor = false;
			this.lblMoney.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.lblMoney.BackColor = Color.Gainsboro;
			this.lblMoney.Enabled = false;
			this.lblMoney.FlatAppearance.BorderSize = 0;
			this.lblMoney.FlatStyle = FlatStyle.Flat;
			this.lblMoney.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.lblMoney.Location = new System.Drawing.Point(382, 2);
			this.lblMoney.Name = "lblMoney";
			this.lblMoney.Size = new Size(102, 20);
			this.lblMoney.TabIndex = 177;
			this.lblMoney.Text = "LIỀU DÙNG";
			this.lblMoney.UseVisualStyleBackColor = false;
			this.lblNumber.BackColor = Color.Gainsboro;
			this.lblNumber.Enabled = false;
			this.lblNumber.FlatAppearance.BorderSize = 0;
			this.lblNumber.FlatStyle = FlatStyle.Flat;
			this.lblNumber.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.lblNumber.Location = new System.Drawing.Point(290, 2);
			this.lblNumber.Name = "lblNumber";
			this.lblNumber.Size = new Size(91, 20);
			this.lblNumber.TabIndex = 175;
			this.lblNumber.Text = "SỐ LƯỢNG";
			this.lblNumber.UseVisualStyleBackColor = false;
			this.lblUnit.BackColor = Color.Gainsboro;
			this.lblUnit.Enabled = false;
			this.lblUnit.FlatAppearance.BorderSize = 0;
			this.lblUnit.FlatStyle = FlatStyle.Flat;
			this.lblUnit.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.lblUnit.Location = new System.Drawing.Point(199, 2);
			this.lblUnit.Name = "lblUnit";
			this.lblUnit.Size = new Size(90, 20);
			this.lblUnit.TabIndex = 174;
			this.lblUnit.Text = "ĐƠN VỊ TÍNH";
			this.lblUnit.UseVisualStyleBackColor = false;
			this.label4.BackColor = Color.FromArgb(255, 255, 192);
			this.label4.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label4.Location = new System.Drawing.Point(7, 117);
			this.label4.Name = "label4";
			this.label4.Size = new Size(230, 21);
			this.label4.TabIndex = 172;
			this.label4.Text = "THÔNG TIN VỀ THUỐC :  ";
			this.label4.TextAlign = ContentAlignment.MiddleRight;
			this.txtProductGuide.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.txtProductGuide.BackColor = Color.White;
			this.txtProductGuide.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtProductGuide.Location = new System.Drawing.Point(382, 24);
			this.txtProductGuide.Name = "txtProductGuide";
			this.txtProductGuide.Size = new Size(102, 22);
			this.txtProductGuide.TabIndex = 15;
			this.txtProductGuide.KeyDown += new KeyEventHandler(this.txtProductGuide_KeyDown);
			this.txtProductGuide.Leave += new EventHandler(this.txtProductGuide_Leave);
			this.txtProductGuide.Enter += new EventHandler(this.txtProductGuide_Enter);
			this.txtUserGuide.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.txtUserGuide.BackColor = Color.White;
			this.txtUserGuide.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtUserGuide.Location = new System.Drawing.Point(140, 377);
			this.txtUserGuide.Name = "txtUserGuide";
			this.txtUserGuide.ReadOnly = true;
			this.txtUserGuide.Size = new Size(537, 22);
			this.txtUserGuide.TabIndex = 17;
			this.label7.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.label7.AutoSize = true;
			this.label7.BackColor = Color.White;
			this.label7.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.label7.Location = new System.Drawing.Point(10, 381);
			this.label7.Name = "label7";
			this.label7.Size = new Size(127, 15);
			this.label7.TabIndex = 563;
			this.label7.Text = "Hướng dẫn sử dụng :";
			this.txtProductNumber1.BackColor = Color.White;
			this.txtProductNumber1.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtProductNumber1.Location = new System.Drawing.Point(290, 24);
			this.txtProductNumber1.Name = "txtProductNumber1";
			this.txtProductNumber1.ReadOnly = true;
			this.txtProductNumber1.Size = new Size(91, 22);
			this.txtProductNumber1.TabIndex = 14;
			this.txtProductNumber1.TextAlign = HorizontalAlignment.Right;
			this.txtProductNumber1.TextChanged += new EventHandler(this.txtProductNumber1_TextChanged);
			this.txtProductNumber1.KeyDown += new KeyEventHandler(this.txtProductNumber1_KeyDown);
			this.txtProductNumber1.Leave += new EventHandler(this.txtProductNumber1_Leave);
			this.txtProductNumber1.Enter += new EventHandler(this.txtProductNumber1_Enter);
			this.tabControl1.Alignment = TabAlignment.Left;
			this.tabControl1.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.tabControl1.Controls.Add(this.tabPage1);
			this.tabControl1.Controls.Add(this.tabPage2);
			this.tabControl1.Location = new System.Drawing.Point(233, 117);
			this.tabControl1.Multiline = true;
			this.tabControl1.Name = "tabControl1";
			this.tabControl1.SelectedIndex = 0;
			this.tabControl1.Size = new Size(710, 439);
			this.tabControl1.TabIndex = 565;
			this.tabPage1.Controls.Add(this.txtProductMoney);
			this.tabPage1.Controls.Add(this.button2);
			this.tabPage1.Controls.Add(this.txtProductPrice);
			this.tabPage1.Controls.Add(this.button1);
			this.tabPage1.Controls.Add(this.btnSelect);
			this.tabPage1.Controls.Add(this.lblProduct);
			this.tabPage1.Controls.Add(this.dgvProduct);
			this.tabPage1.Controls.Add(this.txtProductName);
			this.tabPage1.Controls.Add(this.txtUserGuide);
			this.tabPage1.Controls.Add(this.txtProductNumber1);
			this.tabPage1.Controls.Add(this.label7);
			this.tabPage1.Controls.Add(this.txtProductUnit);
			this.tabPage1.Controls.Add(this.txtDoctorGuide);
			this.tabPage1.Controls.Add(this.lblNumber);
			this.tabPage1.Controls.Add(this.label9);
			this.tabPage1.Controls.Add(this.lblUnit);
			this.tabPage1.Controls.Add(this.txtProductGuide);
			this.tabPage1.Controls.Add(this.lblMoney);
			this.tabPage1.Controls.Add(this.label26);
			this.tabPage1.Location = new System.Drawing.Point(24, 4);
			this.tabPage1.Name = "tabPage1";
			this.tabPage1.Padding = new Padding(3);
			this.tabPage1.Size = new Size(682, 431);
			this.tabPage1.TabIndex = 0;
			this.tabPage1.Text = "Chi tiết đơn thuốc";
			this.tabPage1.UseVisualStyleBackColor = true;
			this.txtProductMoney.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.txtProductMoney.BackColor = Color.White;
			this.txtProductMoney.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtProductMoney.Location = new System.Drawing.Point(577, 24);
			this.txtProductMoney.Name = "txtProductMoney";
			this.txtProductMoney.ReadOnly = true;
			this.txtProductMoney.Size = new Size(100, 22);
			this.txtProductMoney.TabIndex = 566;
			this.txtProductMoney.TextAlign = HorizontalAlignment.Right;
			this.button2.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.button2.BackColor = Color.Gainsboro;
			this.button2.Enabled = false;
			this.button2.FlatAppearance.BorderSize = 0;
			this.button2.FlatStyle = FlatStyle.Flat;
			this.button2.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.button2.Location = new System.Drawing.Point(577, 2);
			this.button2.Name = "button2";
			this.button2.Size = new Size(100, 20);
			this.button2.TabIndex = 567;
			this.button2.Text = "THÀNH TIỀN";
			this.button2.UseVisualStyleBackColor = false;
			this.txtProductPrice.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.txtProductPrice.BackColor = Color.White;
			this.txtProductPrice.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtProductPrice.Location = new System.Drawing.Point(485, 24);
			this.txtProductPrice.Name = "txtProductPrice";
			this.txtProductPrice.ReadOnly = true;
			this.txtProductPrice.Size = new Size(91, 22);
			this.txtProductPrice.TabIndex = 564;
			this.txtProductPrice.TextAlign = HorizontalAlignment.Right;
			this.txtProductPrice.TextChanged += new EventHandler(this.txtProductPrice_TextChanged_1);
			this.txtProductPrice.Leave += new EventHandler(this.txtProductPrice_Leave_1);
			this.txtProductPrice.Enter += new EventHandler(this.txtProductPrice_Enter_1);
			this.button1.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.button1.BackColor = Color.Gainsboro;
			this.button1.Enabled = false;
			this.button1.FlatAppearance.BorderSize = 0;
			this.button1.FlatStyle = FlatStyle.Flat;
			this.button1.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.button1.Location = new System.Drawing.Point(485, 2);
			this.button1.Name = "button1";
			this.button1.Size = new Size(91, 20);
			this.button1.TabIndex = 565;
			this.button1.Text = "ĐƠN GIÁ";
			this.button1.UseVisualStyleBackColor = false;
			this.tabPage2.Controls.Add(this.dgvProductSale);
			this.tabPage2.Location = new System.Drawing.Point(24, 4);
			this.tabPage2.Name = "tabPage2";
			this.tabPage2.Padding = new Padding(3);
			this.tabPage2.Size = new Size(682, 423);
			this.tabPage2.TabIndex = 1;
			this.tabPage2.Text = "Chi tiết đơn thuôc đã bán";
			this.tabPage2.UseVisualStyleBackColor = true;
			this.lblSpace.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.lblSpace.BackColor = Color.White;
			this.lblSpace.Location = new System.Drawing.Point(7, 559);
			this.lblSpace.Name = "lblSpace";
			this.lblSpace.Size = new Size(936, 36);
			this.lblSpace.TabIndex = 566;
			this.btnExport.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.btnExport.Cursor = Cursors.Hand;
			this.btnExport.FlatAppearance.BorderColor = Color.FromArgb(255, 192, 255);
			this.btnExport.FlatStyle = FlatStyle.Flat;
			this.btnExport.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnExport.Location = new System.Drawing.Point(666, 564);
			this.btnExport.Name = "btnExport";
			this.btnExport.Size = new Size(105, 26);
			this.btnExport.TabIndex = 567;
			this.btnExport.Text = "Xuất đơn thuốc";
			this.btnExport.UseVisualStyleBackColor = true;
			this.btnExport.Click += new EventHandler(this.btnExport_Click);
			this.cbbWareHouse.BackColor = Color.White;
			this.cbbWareHouse.Cursor = Cursors.Hand;
			this.cbbWareHouse.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbbWareHouse.FlatStyle = FlatStyle.Flat;
			this.cbbWareHouse.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.cbbWareHouse.FormattingEnabled = true;
			this.cbbWareHouse.Location = new System.Drawing.Point(48, 208);
			this.cbbWareHouse.Name = "cbbWareHouse";
			this.cbbWareHouse.Size = new Size(173, 23);
			this.cbbWareHouse.TabIndex = 90;
			this.txtBalancerAllPacket.BackColor = SystemColors.Control;
			this.txtBalancerAllPacket.Font = new Font("Arial", 9.75f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.txtBalancerAllPacket.Location = new System.Drawing.Point(121, 117);
			this.txtBalancerAllPacket.Name = "txtBalancerAllPacket";
			this.txtBalancerAllPacket.ReadOnly = true;
			this.txtBalancerAllPacket.Size = new Size(95, 22);
			this.txtBalancerAllPacket.TabIndex = 568;
			this.txtBalancerAllPacket.TextAlign = HorizontalAlignment.Right;
			base.AutoScaleDimensions = new SizeF(7f, 15f);
			//base.AutoScaleMode = AutoScaleMode.Font;
			base.ClientSize = new Size(950, 600);
			base.Controls.Add(this.btnExport);
			base.Controls.Add(this.tabControl1);
			base.Controls.Add(this.label4);
			base.Controls.Add(this.btnSearch);
			base.Controls.Add(this.groupBox1);
			base.Controls.Add(this.btnDel);
			base.Controls.Add(this.btnPrint);
			base.Controls.Add(this.btnSave);
			base.Controls.Add(this.btnEdit);
			base.Controls.Add(this.btnClose);
			base.Controls.Add(this.btnAdd);
			base.Controls.Add(this.groupBox3);
			base.Controls.Add(this.dgvBill);
			base.Controls.Add(this.btnAddToBill);
			base.Controls.Add(this.lblSpace);
			base.Controls.Add(this.cbbWareHouse);
			base.Controls.Add(this.txtBalancerAllPacket);
			this.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 0);
			//base.Icon = (System.Drawing.Icon)componentResourceManager.GetObject("$this.Icon");
			//base.Icon = (Icon)componentResourceManager.GetObject("$this.Icon");
			base.KeyPreview = true;
			base.Name = "frmPrescription";
			base.ShowInTaskbar = false;
			base.StartPosition = FormStartPosition.CenterScreen;
			this.Text = "KÊ ĐƠN THUỐC";
			base.Load += new EventHandler(this.frmOutputRetail_Load);
			base.Shown += new EventHandler(this.frmOutputRetailWithDoctor_Shown);
			base.FormClosing += new FormClosingEventHandler(this.frmOutputRetailWithDoctor_FormClosing);
			base.KeyDown += new KeyEventHandler(this.frmOutputRetail_KeyDown);
			this.groupBox3.ResumeLayout(false);
			((ISupportInitialize)this.dgvBill).EndInit();
			this.ctmBill.ResumeLayout(false);
			((ISupportInitialize)this.dgvProduct).EndInit();
			this.cmsBill.ResumeLayout(false);
			this.groupBox1.ResumeLayout(false);
			this.groupBox1.PerformLayout();
			((ISupportInitialize)this.txtAge).EndInit();
			((ISupportInitialize)this.dgvProductSale).EndInit();
			this.tabControl1.ResumeLayout(false);
			this.tabPage1.ResumeLayout(false);
			this.tabPage1.PerformLayout();
			this.tabPage2.ResumeLayout(false);
			base.ResumeLayout(false);
			base.PerformLayout();
		}
		public frmPrescription()
		{
			this.InitializeComponent();
		}
		private void frmOutputRetail_Load(object sender, EventArgs e)
		{
			try
			{
				RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software\\TVSGPP", true);
				this.checkBalancer = bool.Parse(registryKey.GetValue("Prescription").ToString());
				registryKey.Close();
			}
			catch
			{
				this.checkBalancer = false;
			}
			this.BasePrice = this.objFunc.getBasePrice();
			Program.strConnectionString = this.objFunc.GetStrConnectionString();
			this.cbbSex.SelectedIndex = 0;
			string text = "";
			this.currDortorID = this.objDoctor.getDoctorName(this.userName, ref text);
			this.txtDoctor.Text = text;
			this.objFunc.LoadComboBox("SELECT WareHouse_ID, UPPER(WareHouse_Name) AS Name FROM TabWareHouse ORDER BY WareHouse_Name", this.cbbWareHouse, "WareHouse_ID", "Name");
			this.cusID = this.objCus.getRetailID();
			this.getBill();
			this.allowEditPrice = this.objFunc.getAllowEditPrice();
			if (this.allowEditPrice && this.objAccount.checkPerExtention(this.userName, "EditPrice"))
			{
				this.txtProductPrice.ReadOnly = false;
			}
			else
			{
				this.txtProductPrice.ReadOnly = true;
			}
			this.btnAdd.PerformClick();
		}
		private void btnClose_Click(object sender, EventArgs e)
		{
			base.Close();
		}
		private void frmOutputRetail_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Escape)
			{
				base.Close();
			}
			else
			{
				if (e.KeyCode == Keys.F2)
				{
					this.btnSelect.PerformClick();
				}
				else
				{
					if (e.KeyCode == Keys.F3)
					{
						this.btnAddToBill.PerformClick();
					}
					else
					{
						if (e.KeyCode == Keys.F4)
						{
							this.btnAdd.PerformClick();
						}
						else
						{
							if (e.KeyCode == Keys.F5)
							{
								this.btnEdit.PerformClick();
							}
							else
							{
								if (e.KeyCode == Keys.F6)
								{
									this.btnSave.PerformClick();
								}
								else
								{
									if (e.KeyCode == Keys.F7)
									{
										this.btnPrint.PerformClick();
									}
									else
									{
										if (e.KeyCode == Keys.F8)
										{
											this.btnDel.PerformClick();
										}
										else
										{
											if (e.KeyCode == Keys.F9)
											{
												this.btnSearch.PerformClick();
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
		private void btnSave_Click(object sender, EventArgs e)
		{
			if (this.dgvProduct.Rows.Count == 0)
			{
				MessageBox.Show("Bạn chưa chọn loại thuốc cần kê đơn !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			}
			else
			{
				string text;
				if (this.cbbSex.Text == "NAM")
				{
					text = "1";
				}
				else
				{
					text = "0";
				}
				this.currCusID = this.objDoctor.cusPrescription(this.currCusID, this.txtName.Text, this.txtAge.Value.ToString(), text, this.txtAddress.Text, this.txtPhone.Text);
				if (this.txtID.Text.Trim() != "-:-")
				{
					this.objDoctor.savePrescription(this.txtID.Text, this.txtDate.Value, this.currDortorID, this.txtName.Text, this.txtAge.Value.ToString(), text, this.txtAddress.Text, this.txtPhone.Text, this.txtDoctor.Text, this.currCusID, this.txtDesease.Text, this.txtUserGuide.Text, this.txtDoctorGuide.Text);
				}
				else
				{
					this.txtID.Text = this.objDoctor.savePrescription(this.txtID.Text, this.txtDate.Value, this.currDortorID, this.txtName.Text, this.txtAge.Value.ToString(), text, this.txtAddress.Text, this.txtPhone.Text, this.txtDoctor.Text, this.currCusID, this.txtDesease.Text, this.txtUserGuide.Text, this.txtDoctorGuide.Text);
				}
				this.objDoctor.savePrescriptionDetail(this.txtID.Text, this.objProductTable);
				this.getBill();
				this.EnableControl(false);
			}
		}
		private void btnEdit_Click(object sender, EventArgs e)
		{
			this.EnableControl(true);
		}
		private void btnAdd_Click(object sender, EventArgs e)
		{
			this.objProductTable = new DataTable();
			DataColumn column = new DataColumn("ProductID", typeof(string));
			DataColumn column2 = new DataColumn("ProductName", typeof(string));
			DataColumn column3 = new DataColumn("ProductUnit", typeof(string));
			DataColumn column4 = new DataColumn("ProductNumber", typeof(string));
			DataColumn column5 = new DataColumn("ProductGuide", typeof(string));
			DataColumn column6 = new DataColumn("ProductPrice", typeof(string));
			DataColumn column7 = new DataColumn("ProductMoney", typeof(string));
			this.objProductTable.Columns.Add(column);
			this.objProductTable.Columns.Add(column2);
			this.objProductTable.Columns.Add(column3);
			this.objProductTable.Columns.Add(column4);
			this.objProductTable.Columns.Add(column5);
			this.objProductTable.Columns.Add(column6);
			this.objProductTable.Columns.Add(column7);
			this.dgvProduct.DataSource = this.objProductTable;
			this.txtName.Text = "";
			this.txtAge.Value = 0m;
			this.cbbSex.SelectedIndex = 0;
			this.txtAddress.Text = "";
			this.txtDesease.Text = "";
			this.txtUserGuide.Text = "";
			this.txtProductName.Text = "";
			this.currPid = "0";
			this.txtDoctorGuide.Text = "";
			this.txtProductNumber1.Text = "";
			this.txtProductGuide.Text = "";
			this.txtProductUnit.Text = "";
			this.EnableControl(true);
			this.currCusID = "0";
			this.txtID.Text = "-:-";
			this.btnTmp.Enabled = true;
			this.txtPhone.Text = "";
			this.txtName.Focus();
		}
		private void EnableControl(bool Act)
		{
			this.txtName.ReadOnly = !Act;
			this.txtAge.ReadOnly = !Act;
			this.txtAddress.ReadOnly = !Act;
			this.txtPhone.ReadOnly = !Act;
			this.txtDesease.ReadOnly = !Act;
			this.txtUserGuide.ReadOnly = !Act;
			this.txtDoctorGuide.ReadOnly = !Act;
			this.btnAddToBill.Enabled = Act;
			this.btnSelect.Enabled = Act;
			this.btnSave.Enabled = Act;
			this.btnTmp.Enabled = Act;
		}
		private void btnPrint_Click(object sender, EventArgs e)
		{
			try
			{
				frmPrescriptionPrint.objTable = this.objProductTable;
				frmPrescriptionPrint.billID = this.txtID.Text;
				frmPrescriptionPrint.FullName = this.txtName.Text;
				frmPrescriptionPrint.Age = this.txtAge.Value.ToString();
				frmPrescriptionPrint.Gender = this.cbbSex.Text;
				frmPrescriptionPrint.Address = this.txtAddress.Text;
				frmPrescriptionPrint.Phone = this.txtPhone.Text;
				frmPrescriptionPrint.Desease = this.txtDesease.Text;
				frmPrescriptionPrint.DoctorGuide = this.txtDoctorGuide.Text;
				frmPrescriptionPrint.objDateTimePrint = this.txtDate.Value;
				frmPrescriptionPrint.UserName = this.userName;
				frmPrescriptionPrint.DoctorName = this.txtDoctor.Text;
				frmPrescriptionView frmPrescriptionView = new frmPrescriptionView();
				frmPrescriptionView.ShowDialog();
			}
			catch
			{
			}
		}
		private void btnDel_Click(object sender, EventArgs e)
		{
			if (this.txtID.Text.Trim() != "-:-")
			{
				if (MessageBox.Show("Bạn có chắc chắn muốn xoá đơn thuốc [ " + this.txtID.Text.ToUpper() + " ] không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
				{
					this.objDoctor.delPrescription(this.txtID.Text);
					this.txtName.Text = "";
					this.txtAge.Value = 0m;
					this.cbbSex.SelectedIndex = 0;
					this.txtAddress.Text = "";
					this.txtDesease.Text = "";
					this.txtUserGuide.Text = "";
					this.txtDoctorGuide.Text = "";
					this.EnableControl(true);
					this.currCusID = "0";
					this.txtID.Text = "-:-";
					this.getBill();
				}
			}
		}
		private void btnSelect_Click(object sender, EventArgs e)
		{
			if (this.btnSave.Enabled)
			{
				this.txtBalancerAllPacket.Text = "0";
				this.tmpUsage = "";
				this.txtProductNumber1.Text = "1";
				this.txtProductName.Text = "";
				this.txtProductUnit.Text = "";
				this.txtProductGuide.Text = "";
				frmSelectProduct frmSelectProduct = new frmSelectProduct();
				frmSelectProduct.checkBalancer = this.checkBalancer;
				frmSelectProduct.txtSearch.Text = this.txtProductName.Text;
				frmSelectProduct.isInput = true;
				frmSelectProduct.Location = new System.Drawing.Point(this.txtProductName.Location.X + 351, this.btnSelect.Location.Y + 202);
				frmSelectProduct.ShowDialog();
				if (frmSelectProduct.productID != "")
				{
					if (!this.AllowSellSuppen)
					{
						if (this.objProduct.checkForSuppend(frmSelectProduct.productID, "0"))
						{
							MessageBox.Show("Bạn đang chọn mặt thuốc\r\n\r\n" + frmSelectProduct.productName + "\r\n\r\nThuộc danh mục thuốc cấm lưu hành nên không thể nhập kho", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
							return;
						}
					}
					this.currPid = frmSelectProduct.productID;
					this.txtBalancerAllPacket.Text = this.objProduct.balancerOfAllPack(this.currPid, this.cbbWareHouse.SelectedValue.ToString()).ToString();
					this.balancerAllPacket = this.objProduct.balancerOfAllPack(this.currPid);
					this.txtProductName.Text = frmSelectProduct.productName;
					this.txtProductUnit.Text = frmSelectProduct.unitName;
					this.tmpUsage = this.getUsageProduct(this.currPid);
					this.txtProductGuide.Text = this.tmpUsage;
					this.txtProductNumber1.Focus();
				}
				try
				{
					if (this.BasePrice)
					{
						this.txtProductPrice.Text = this.objProduct.getPriceOutRetailBase(this.currPid).ToString();
					}
					else
					{
						this.txtProductPrice.Text = this.objProduct.getPriceOutRetailAVG(this.currPid).ToString();
					}
				}
				catch (Exception ex)
				{
					MessageBox.Show(ex.Message);
				}
			}
		}
		private void btnAddToBill_Click(object sender, EventArgs e)
		{
			try
			{
				if (this.txtProductName.Text.Trim() == "")
				{
					MessageBox.Show("Bạn chưa chọn loại thuốc cần kê đơn !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
					this.txtProductName.Focus();
				}
				else
				{
					if (this.txtProductUnit.Text.Trim() == "")
					{
						MessageBox.Show("Bạn chưa chọn đơn vị tính của loại thuốc cần kê đơn !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
						this.txtProductUnit.Focus();
					}
					else
					{
						if (this.txtProductNumber1.Text.Trim() == "0" || this.txtProductNumber1.Text.Trim() == "")
						{
							MessageBox.Show("Bạn chưa chọn số lượng thuốc cần kê đơn !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
							this.txtProductNumber1.Focus();
						}
						else
						{
							float num = float.Parse(this.txtProductNumber1.Text);
							float num2 = float.Parse(this.txtBalancerAllPacket.Text);
							if (num > num2)
							{
								MessageBox.Show("Số lượng xuất kho lớn hơn số lượng hàng còn trong kho", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
								this.txtProductNumber1.Text = this.txtBalancerAllPacket.Text;
							}
							else
							{
								try
								{
									double num3 = double.Parse(this.txtProductNumber1.Text);
								}
								catch
								{
									MessageBox.Show("Bạn chưa chọn số lượng thuốc cần kê đơn !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
									this.txtProductNumber1.Focus();
									return;
								}
								int num4 = this.checkInObjTable(this.currPid);
								if (num4 == -1)
								{
									this.objProductTable.Rows.Add(new object[]
									{
										this.currPid,
										this.txtProductName.Text + "\r\n" + this.objProduct.getIngredient(this.currPid.ToString()),
										this.txtProductUnit.Text,
										this.txtProductNumber1.Text,
										this.txtProductGuide.Text,
										this.txtProductPrice.Text.Replace(",", ""),
										this.txtProductMoney.Text.Replace(",", "")
									});
								}
								else
								{
									this.updateObjTable(num4);
								}
								if (this.tmpUsage != "" && this.txtProductGuide.Text.Trim() != this.tmpUsage.Trim())
								{
									this.UpdateUsageProduct(this.currPid, this.txtProductGuide.Text);
								}
								this.dgvProduct.DataSource = this.objProductTable;
								this.txtProductName.Text = "";
								this.txtProductUnit.Text = "";
								this.txtProductNumber1.Text = "1";
								this.txtProductGuide.Text = "";
								this.txtProductName.Focus();
							}
						}
					}
				}
			}
			catch
			{
			}
		}
		private void updateObjTable(int index)
		{
			this.objProductTable.Rows[index]["ProductID"] = this.currPid;
			this.objProductTable.Rows[index]["ProductName"] = this.txtProductName.Text;
			this.objProductTable.Rows[index]["ProductUnit"] = this.txtProductUnit.Text;
			this.objProductTable.Rows[index]["ProductNumber"] = this.txtProductNumber1.Text;
			this.objProductTable.Rows[index]["ProductGuide"] = this.txtProductGuide.Text;
			this.objProductTable.Rows[index]["ProductPrice"] = this.txtProductPrice.Text.Replace(",", "");
			this.objProductTable.Rows[index]["ProductMoney"] = this.txtProductMoney.Text.Replace(",", "");
			MessageBox.Show("OK");
		}
		private void txtProductName_TextChanged(object sender, EventArgs e)
		{
		}
		private void getBill()
		{
			try
			{
				this.dgvBill.AutoGenerateColumns = false;
				this.dgvProduct.DataSource = null;
				this.dgvProduct.AutoGenerateColumns = false;
				SqlConnection sqlConnection = new SqlConnection(this.objFunc.strConnectionString);
				string cmdText = "SELECT * FROM [TabPrescription] WHERE [doctorID] = '" + this.currDortorID + "' AND DateCreate BETWEEN @ObjDate1 AND @objDate2 ORDER BY [DateCreate], [ID] DESC";
				SqlCommand sqlCommand = new SqlCommand(cmdText, sqlConnection);
				SqlParameter sqlParameter = new SqlParameter("ObjDate1", SqlDbType.DateTime);
				SqlParameter sqlParameter2 = new SqlParameter("ObjDate2", SqlDbType.DateTime);
				sqlParameter.Value = DateTime.Parse(this.dtpFrom.Value.ToString().Substring(0, 10) + " 00:00:00 AM");
				sqlParameter2.Value = DateTime.Parse(this.dtpTo.Value.ToString().Substring(0, 10) + " 11:59:59 PM");
				sqlCommand.Parameters.Add(sqlParameter);
				sqlCommand.Parameters.Add(sqlParameter2);
				SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
				DataSet dataSet = new DataSet();
				sqlConnection.Open();
				sqlDataAdapter.Fill(dataSet);
				this.dgvBill.DataSource = dataSet.Tables[0];
				sqlConnection.Close();
				sqlConnection.Dispose();
				sqlDataAdapter.Dispose();
				dataSet.Dispose();
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}
		private void txtProductUnit_TextChanged(object sender, EventArgs e)
		{
		}
		private void txtProductPrice_TextChanged(object sender, EventArgs e)
		{
			this.objFunc.txtObject_Leave(sender);
		}
		private void txtProductNumber_TextChanged(object sender, EventArgs e)
		{
		}
		private void txtProductMoney_TextChanged(object sender, EventArgs e)
		{
			this.objFunc.txtObject_Leave(sender);
		}
		private void dgvProduct_CellEnter(object sender, DataGridViewCellEventArgs e)
		{
			try
			{
				this.currPid = this.dgvProduct.Rows[e.RowIndex].Cells["ProductID"].Value.ToString();
				this.txtProductName.Text = this.dgvProduct.Rows[e.RowIndex].Cells["ProductName"].Value.ToString();
				this.txtProductUnit.Text = this.dgvProduct.Rows[e.RowIndex].Cells["ProductUnit"].Value.ToString();
				this.txtProductNumber1.Text = this.dgvProduct.Rows[e.RowIndex].Cells["ProductNumber"].Value.ToString();
				this.txtProductGuide.Text = this.dgvProduct.Rows[e.RowIndex].Cells["ProductGuide"].Value.ToString();
				this.txtProductPrice.Text = this.dgvProduct.Rows[e.RowIndex].Cells["ProductPrice"].Value.ToString();
				this.txtProductMoney.Text = this.dgvProduct.Rows[e.RowIndex].Cells["ProductMoney"].Value.ToString();
			}
			catch
			{
			}
		}
		private void dgvProduct_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Delete && this.btnSave.Enabled)
			{
				for (int i = 0; i < this.objProductTable.Rows.Count; i++)
				{
					if (this.objProductTable.Rows[i]["ProductID"].ToString() == this.currPid)
					{
						this.objProductTable.Rows[i].Delete();
						break;
					}
				}
				this.dgvProduct.DataSource = this.objProductTable;
				this.dgvProduct.Refresh();
			}
		}
		private void cbbPacket_SelectedIndexChanged(object sender, EventArgs e)
		{
		}
		private void dtpSelectMonth_ValueChanged(object sender, EventArgs e)
		{
		}
		private void txtBarcode_TextChanged(object sender, EventArgs e)
		{
		}
		private void btnSearch_Click(object sender, EventArgs e)
		{
		}
		private void btnViewAll_Click(object sender, EventArgs e)
		{
		}
		private void txtProductNumber_Leave(object sender, EventArgs e)
		{
			this.txtProductNumber1.BackColor = Color.White;
		}
		private void txtProductMoney_Leave(object sender, EventArgs e)
		{
			this.objFunc.txtObject_Leave(sender);
		}
		private void txtBalancer_Leave(object sender, EventArgs e)
		{
			this.objFunc.txtObject_Leave(sender);
		}
		private void txtTotalMoney_Leave(object sender, EventArgs e)
		{
			this.objFunc.txtObject_Leave(sender);
		}
		private void txtTotalMoney_TextChanged(object sender, EventArgs e)
		{
			this.objFunc.txtObject_Leave(sender);
		}
		private void btnFind_Click(object sender, EventArgs e)
		{
			frmFindCustomerFree frmFindCustomerFree = new frmFindCustomerFree();
			frmFindCustomerFree.Location = new System.Drawing.Point(this.txtName.Location.X + 101, this.txtName.Location.Y + 110);
			frmFindCustomerFree.ShowDialog();
			if (frmFindCustomerFree._Name.Trim() != "")
			{
				this.txtName.Text = frmFindCustomerFree._Name;
				this.txtAddress.Text = frmFindCustomerFree._Address;
				this.txtPhone.Text = frmFindCustomerFree._Phone;
				this.txtAge.Text = frmFindCustomerFree._Age;
				this.cbbSex.SelectedValue = frmFindCustomerFree._Gender;
			}
		}
		private void btnListUnit_Click(object sender, EventArgs e)
		{
		}
		private void txtBarcode_KeyDown(object sender, KeyEventArgs e)
		{
		}
		private void cmsAddBill_Click(object sender, EventArgs e)
		{
			this.btnAdd.PerformClick();
		}
		private void cmsEditBill_Click(object sender, EventArgs e)
		{
			this.btnEdit.PerformClick();
		}
		private void cmsSaveBill_Click(object sender, EventArgs e)
		{
			this.btnSave.PerformClick();
		}
		private void cmsPrintBill_Click(object sender, EventArgs e)
		{
			this.btnPrint.PerformClick();
		}
		private void cmsDellBill_Click(object sender, EventArgs e)
		{
			this.btnDel.PerformClick();
		}
		private void cmsSearchBill_Click(object sender, EventArgs e)
		{
			this.btnSearch.PerformClick();
		}
		private void btnSave_EnabledChanged(object sender, EventArgs e)
		{
			this.cmsAddProduct.Enabled = this.btnSave.Enabled;
			this.cmsSaveBill.Enabled = this.btnSave.Enabled;
			this.cmsDelProduct.Enabled = this.btnSave.Enabled;
			this.txtProductName.ReadOnly = !this.btnSave.Enabled;
			this.txtProductNumber1.ReadOnly = !this.btnSave.Enabled;
			this.txtProductUnit.ReadOnly = !this.btnSave.Enabled;
			this.txtProductGuide.ReadOnly = !this.btnSave.Enabled;
		}
		private void btnDel_EnabledChanged(object sender, EventArgs e)
		{
			this.cmsDellBill.Enabled = this.btnDel.Enabled;
		}
		private void btnPrint_EnabledChanged(object sender, EventArgs e)
		{
			this.cmsPrintBill.Enabled = this.btnPrint.Enabled;
		}
		private void txtProductNumber_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Return)
			{
				this.txtProductGuide.Focus();
			}
		}
		private void txtProductName_KeyPress(object sender, KeyPressEventArgs e)
		{
		}
		private void txtProductUnit_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
				this.txtProductNumber1.Focus();
			}
		}
		private void cbbPacket_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
				this.txtProductUnit.Focus();
			}
		}
		private void txtProductPrice_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
				this.txtProductNumber1.Focus();
			}
		}
		private void txtProductNumber_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
				this.btnAddToBill.PerformClick();
			}
		}
		private void txtID_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
				this.txtName.Focus();
			}
		}
		private void txtName_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
				this.txtAge.Focus();
			}
		}
		private void txtAge_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
				this.cbbSex.Focus();
			}
		}
		private void cbbSex_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
				this.txtAddress.Focus();
			}
		}
		private void txtDate_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
				this.txtAddress.Focus();
			}
		}
		private void txtAddress_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
				this.txtPhone.Focus();
			}
		}
		private void txtPhone_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
				this.txtDesease.Focus();
			}
		}
		private void txtNote_KeyPress(object sender, KeyPressEventArgs e)
		{
		}
		private void txtDoctor_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
				this.txtProductName.Focus();
			}
		}
		private void txtDesease_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r' && this.dgvProduct.RowCount == 0)
			{
				this.btnTmp.PerformClick();
			}
			else
			{
				if (e.KeyChar == '\r')
				{
					this.txtDoctor.Focus();
				}
			}
		}
		private void txtProductName_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyData == Keys.Down)
			{
				if (this.txtProductName.Text.Trim() != "")
				{
					this.btnSelect.PerformClick();
				}
			}
			else
			{
				if (e.KeyData == Keys.Return)
				{
					if (this.txtProductName.Text.Trim() == "")
					{
						this.btnSelect.PerformClick();
					}
					else
					{
						this.txtProductUnit.Focus();
					}
				}
			}
		}
		private void txtID_Enter(object sender, EventArgs e)
		{
			this.txtID.BackColor = Color.Aqua;
		}
		private void txtID_Leave(object sender, EventArgs e)
		{
			this.txtID.BackColor = Color.White;
		}
		private void txtName_Enter(object sender, EventArgs e)
		{
			this.txtName.BackColor = Color.Aqua;
		}
		private void txtName_Leave(object sender, EventArgs e)
		{
			this.txtName.BackColor = Color.White;
		}
		private void txtAge_Enter(object sender, EventArgs e)
		{
			this.txtAge.BackColor = Color.Aqua;
		}
		private void txtAge_Leave(object sender, EventArgs e)
		{
			this.txtAge.BackColor = Color.White;
		}
		private void txtAddress_Enter(object sender, EventArgs e)
		{
			this.txtAddress.BackColor = Color.Aqua;
		}
		private void txtAddress_Leave(object sender, EventArgs e)
		{
			this.txtAddress.BackColor = Color.White;
		}
		private void txtPhone_Enter(object sender, EventArgs e)
		{
			this.txtPhone.BackColor = Color.Aqua;
		}
		private void txtPhone_Leave(object sender, EventArgs e)
		{
			this.txtPhone.BackColor = Color.White;
		}
		private void txtNote_Enter(object sender, EventArgs e)
		{
			this.txtDoctorGuide.BackColor = Color.Aqua;
		}
		private void txtNote_Leave(object sender, EventArgs e)
		{
			this.txtDoctorGuide.BackColor = Color.White;
		}
		private void txtDoctor_Enter(object sender, EventArgs e)
		{
			this.txtDoctor.BackColor = Color.Aqua;
		}
		private void txtDoctor_Leave(object sender, EventArgs e)
		{
			this.txtDoctor.BackColor = Color.White;
		}
		private void txtDesease_Enter(object sender, EventArgs e)
		{
			this.txtDesease.BackColor = Color.Aqua;
		}
		private void txtDesease_Leave(object sender, EventArgs e)
		{
			this.txtDesease.BackColor = Color.White;
		}
		private void txtProductName_Enter(object sender, EventArgs e)
		{
			this.txtProductName.BackColor = Color.Aqua;
		}
		private void txtProductName_Leave(object sender, EventArgs e)
		{
			this.txtProductName.BackColor = Color.White;
		}
		private void txtProductUnit_Enter(object sender, EventArgs e)
		{
			this.txtProductUnit.BackColor = Color.Aqua;
		}
		private void txtProductUnit_Leave(object sender, EventArgs e)
		{
			this.txtProductUnit.BackColor = Color.White;
		}
		private void txtProductPrice_Enter(object sender, EventArgs e)
		{
		}
		private void txtProductPrice_Leave(object sender, EventArgs e)
		{
		}
		private void txtProductNumber_Enter(object sender, EventArgs e)
		{
			this.txtProductNumber1.BackColor = Color.Aqua;
		}
		private void frmOutputRetailWithDoctor_FormClosing(object sender, FormClosingEventArgs e)
		{
			if (this.btnSave.Enabled)
			{
				if (MessageBox.Show("Bạn có muốn ghi lại thông tin về hoá đơn hiện tại không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
				{
					e.Cancel = true;
					this.btnSave.PerformClick();
				}
			}
		}
		private void frmOutputRetailWithDoctor_Shown(object sender, EventArgs e)
		{
			this.btnAdd.PerformClick();
		}
		private void btnSearchTime_Click(object sender, EventArgs e)
		{
			this.getBill();
		}
		private void txtMoney_TextChanged(object sender, EventArgs e)
		{
		}
		private void txtDiscountOut_TextChanged(object sender, EventArgs e)
		{
		}
		private void txtDiscountOut_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == '\r')
			{
				this.btnSave.PerformClick();
			}
		}
		private void txtMoneyAfterDiscount_Leave(object sender, EventArgs e)
		{
		}
		private void ctmBillAdd_Click(object sender, EventArgs e)
		{
			this.btnAdd.PerformClick();
		}
		private void ctmBillEdit_Click(object sender, EventArgs e)
		{
			this.btnEdit.PerformClick();
		}
		private void ctmBillPrint_Click(object sender, EventArgs e)
		{
			this.btnPrint.PerformClick();
		}
		private void ctmBillDel_Click(object sender, EventArgs e)
		{
			this.btnDel.PerformClick();
		}
		private void ctmBillSearchAdvance_Click(object sender, EventArgs e)
		{
			this.btnSearch.PerformClick();
		}
		private void txtProductGuide_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Return)
			{
				this.btnAddToBill.PerformClick();
			}
		}
		private void txtProductGuide_Enter(object sender, EventArgs e)
		{
			this.txtProductGuide.BackColor = Color.Aqua;
		}
		private void txtProductGuide_Leave(object sender, EventArgs e)
		{
			this.txtProductGuide.BackColor = Color.White;
		}
		private int checkInObjTable(string Pid)
		{
			int num = -1;
			int result;
			for (int i = 0; i < this.objProductTable.Rows.Count; i++)
			{
				if (this.objProductTable.Rows[i]["ProductID"].ToString() == Pid)
				{
					result = i;
					return result;
				}
			}
			result = num;
			return result;
		}
		private void cmsDelProduct_Click(object sender, EventArgs e)
		{
			if (this.btnSave.Enabled)
			{
				try
				{
					for (int i = 0; i < this.objProductTable.Rows.Count; i++)
					{
						if (this.objProductTable.Rows[i]["ProductID"].ToString() == this.currPid)
						{
							this.objProductTable.Rows[i].Delete();
							break;
						}
					}
					this.dgvProduct.DataSource = this.objProductTable;
					this.dgvProduct.Refresh();
				}
				catch (Exception ex)
				{
					MessageBox.Show(ex.Message);
				}
			}
		}
		private void btnSelectPatien_Click(object sender, EventArgs e)
		{
			frmListPatient frmListPatient = new frmListPatient();
			frmListPatient.ShowDialog();
			if (frmListPatient.isSelect)
			{
				this.txtName.Text = frmListPatient.lblHoTen.Text;
				this.txtAddress.Text = frmListPatient.lblDiaChi.Text;
				this.txtPhone.Text = frmListPatient.lblDienThoai.Text;
				try
				{
					this.txtAge.Value = DateTime.Now.Year - int.Parse(frmListPatient.lblNamSinh.Text.Trim().Substring(frmListPatient.lblNamSinh.Text.Trim().Length - 4, 4));
				}
				catch
				{
					this.txtAge.Value = 0m;
				}
			}
		}
		private void txtProductNumber1_Enter(object sender, EventArgs e)
		{
			this.txtProductNumber1.BackColor = Color.Aqua;
		}
		private void txtProductNumber1_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Return)
			{
				this.txtProductGuide.Focus();
			}
		}
		private void txtProductNumber1_Leave(object sender, EventArgs e)
		{
			this.txtProductNumber1.BackColor = Color.White;
			if (this.checkBalancer)
			{
				try
				{
					if (this.txtProductNumber1.Text.Trim() != "")
					{
						if (double.Parse(this.txtProductNumber1.Text) > (double)this.balancerAllPacket)
						{
							MessageBox.Show("Số lượng thuốc tồn kho không đủ để bán !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
							this.txtProductNumber1.Focus();
						}
					}
				}
				catch
				{
				}
			}
		}
		public string getUsageProduct(string Pid)
		{
			string result = "";
			try
			{
				SqlConnection sqlConnection = new SqlConnection(Program.strConnectionString);
				sqlConnection.Open();
				SqlCommand sqlCommand = new SqlCommand("SELECT [Usage] FROM [TabProducts] WHERE [Pid] = " + Pid, sqlConnection);
				SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
				while (sqlDataReader.Read())
				{
					result = sqlDataReader["Usage"].ToString();
				}
				sqlDataReader.Close();
				sqlConnection.Close();
				sqlConnection.Dispose();
			}
			catch
			{
			}
			return result;
		}
		private void UpdateUsageProduct(string tmpID, string Usage)
		{
			SqlConnection sqlConnection = new SqlConnection(Program.strConnectionString);
			sqlConnection.Open();
			SqlCommand sqlCommand = new SqlCommand("UpdateUsageOfProduct", sqlConnection);
			sqlCommand.CommandType = CommandType.StoredProcedure;
			sqlCommand.Parameters.Add("PID", SqlDbType.Int);
			sqlCommand.Parameters.Add("Usage", SqlDbType.NVarChar, 2000);
			sqlCommand.Parameters["PID"].Value = tmpID;
			sqlCommand.Parameters["Usage"].Value = Usage;
			sqlCommand.ExecuteNonQuery();
			sqlConnection.Close();
			sqlConnection.Dispose();
		}
		private void btnTmp_Click(object sender, EventArgs e)
		{
			frmFindTmpPrescription frmFindTmpPrescription = new frmFindTmpPrescription();
			frmFindTmpPrescription.currDeseaseName = this.txtDesease.Text.Trim();
			frmFindTmpPrescription.ShowDialog();
			if (frmFindTmpPrescription.OK)
			{
				this.objProductTable = new DataTable();
				this.objProductTable = frmFindTmpPrescription.objProductTable;
				this.dgvProduct.DataSource = this.objProductTable;
			}
		}
		private void dgvBill_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
		{
			DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle();
			dataGridViewCellStyle.BackColor = SystemColors.ScrollBar;
			DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle();
			dataGridViewCellStyle2.BackColor = Color.White;
			if (this.dgvBill.Rows[e.RowIndex].Cells["Status"].Value.ToString() == "0")
			{
				this.dgvBill.Rows[e.RowIndex].Cells[0].Style = dataGridViewCellStyle2;
				this.dgvBill.Rows[e.RowIndex].Cells[1].Style = dataGridViewCellStyle2;
			}
			else
			{
				this.dgvBill.Rows[e.RowIndex].Cells[0].Style = dataGridViewCellStyle;
				this.dgvBill.Rows[e.RowIndex].Cells[1].Style = dataGridViewCellStyle;
			}
		}
		private void dgvProductSale_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
		{
			DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle();
			dataGridViewCellStyle.BackColor = SystemColors.ScrollBar;
			DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle();
			dataGridViewCellStyle2.BackColor = Color.White;
			if (this.dgvProductSale.Rows[e.RowIndex].Cells["ProductNumber1"].Value.ToString().Trim() == this.dgvProductSale.Rows[e.RowIndex].Cells["ProductNumberSale"].Value.ToString().Trim())
			{
				this.dgvProductSale.Rows[e.RowIndex].Cells[0].Style = dataGridViewCellStyle2;
				this.dgvProductSale.Rows[e.RowIndex].Cells[1].Style = dataGridViewCellStyle2;
				this.dgvProductSale.Rows[e.RowIndex].Cells[2].Style = dataGridViewCellStyle2;
				this.dgvProductSale.Rows[e.RowIndex].Cells[3].Style = dataGridViewCellStyle2;
				this.dgvProductSale.Rows[e.RowIndex].Cells[4].Style = dataGridViewCellStyle2;
				this.dgvProductSale.Rows[e.RowIndex].Cells[5].Style = dataGridViewCellStyle2;
			}
			else
			{
				this.dgvProductSale.Rows[e.RowIndex].Cells[0].Style = dataGridViewCellStyle;
				this.dgvProductSale.Rows[e.RowIndex].Cells[1].Style = dataGridViewCellStyle;
				this.dgvProductSale.Rows[e.RowIndex].Cells[2].Style = dataGridViewCellStyle;
				this.dgvProductSale.Rows[e.RowIndex].Cells[3].Style = dataGridViewCellStyle;
				this.dgvProductSale.Rows[e.RowIndex].Cells[4].Style = dataGridViewCellStyle;
				this.dgvProductSale.Rows[e.RowIndex].Cells[5].Style = dataGridViewCellStyle;
			}
		}
		private void txtProductPrice_Enter_1(object sender, EventArgs e)
		{
		}
		private void txtProductPrice_Leave_1(object sender, EventArgs e)
		{
		}
		private void txtProductPrice_TextChanged_1(object sender, EventArgs e)
		{
			try
			{
				this.txtProductPrice.Text = string.Format(Program.lenAffterDecimal, double.Parse(this.txtProductPrice.Text));
				this.txtProductMoney.Text = string.Format(Program.lenAffterDecimal, double.Parse(this.txtProductPrice.Text) * double.Parse(this.txtProductNumber1.Text));
			}
			catch
			{
			}
		}
		private void dgvBill_CellEnter(object sender, DataGridViewCellEventArgs e)
		{
			try
			{
				this.objProductTable = new DataTable();
				this.txtID.Text = this.dgvBill.Rows[e.RowIndex].Cells["billID"].Value.ToString();
				this.txtName.Text = this.dgvBill.Rows[e.RowIndex].Cells["PatientName"].Value.ToString();
				this.txtDate.Value = DateTime.Parse(this.dgvBill.Rows[e.RowIndex].Cells["DateCreate"].Value.ToString());
				this.txtAddress.Text = this.dgvBill.Rows[e.RowIndex].Cells["PatientAddress"].Value.ToString();
				this.txtAge.Value = int.Parse(this.dgvBill.Rows[e.RowIndex].Cells["PatientAge"].Value.ToString());
				this.cbbSex.Text = this.dgvBill.Rows[e.RowIndex].Cells["PatientSex"].Value.ToString().Replace("1", "NAM").Replace("0", "NỮ");
				this.txtPhone.Text = this.dgvBill.Rows[e.RowIndex].Cells["PatientPhone"].Value.ToString();
				this.txtDoctor.Text = this.dgvBill.Rows[e.RowIndex].Cells["DoctorName"].Value.ToString();
				this.txtDesease.Text = this.dgvBill.Rows[e.RowIndex].Cells["Desease"].Value.ToString();
				this.currCusID = this.dgvBill.Rows[e.RowIndex].Cells["PatientID"].Value.ToString();
				this.txtUserGuide.Text = this.dgvBill.Rows[e.RowIndex].Cells["UserGuide"].Value.ToString();
				this.txtDoctorGuide.Text = this.dgvBill.Rows[e.RowIndex].Cells["DoctorGuide"].Value.ToString();
				this.dgvProductSale.DataSource = this.objDoctor.getPrescriptionDetailSale(this.txtID.Text);
				this.objProductTable = this.objDoctor.getPrescriptionDetail(this.txtID.Text);
				this.dgvProduct.DataSource = this.objProductTable;
				this.btnSave.Enabled = false;
				this.btnEdit.Enabled = true;
				this.btnDel.Enabled = true;
				this.btnPrint.Enabled = true;
			}
			catch
			{
			}
		}
		private void btnExport_Click(object sender, EventArgs e)
		{
			if (MessageBox.Show("Bạn có muốn xuất thuốc theo đơn này không ?", "VIP 3S - Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.No)
			{
				try
				{
					this.objTable = new DataTable();
					DataColumn column = new DataColumn("Pid", typeof(string));
					DataColumn column2 = new DataColumn("ProductName", typeof(string));
					DataColumn column3 = new DataColumn("ProductUnit", typeof(string));
					DataColumn column4 = new DataColumn("ProductNumber", typeof(string));
					DataColumn column5 = new DataColumn("ProductPrice", typeof(string));
					DataColumn column6 = new DataColumn("ProductMoney", typeof(string));
					DataColumn column7 = new DataColumn("Packet", typeof(string));
					DataColumn column8 = new DataColumn("ProductDate", typeof(DateTime));
					DataColumn column9 = new DataColumn("ProductExpiryDate", typeof(DateTime));
					DataColumn column10 = new DataColumn("ProductPrice1", typeof(string));
					DataColumn column11 = new DataColumn("ProductPrice2", typeof(string));
					DataColumn column12 = new DataColumn("NationalID", typeof(string));
					DataColumn column13 = new DataColumn("VAT", typeof(string));
					DataColumn column14 = new DataColumn("possName", typeof(string));
					DataColumn column15 = new DataColumn("Rate", typeof(string));
					DataColumn column16 = new DataColumn("IdRegisters", typeof(string));
					DataColumn column17 = new DataColumn("IdControl", typeof(string));
					DataColumn column18 = new DataColumn("IdBisMake", typeof(string));
					DataColumn column19 = new DataColumn("IdBisImport", typeof(string));
					DataColumn column20 = new DataColumn("VATasMoney", typeof(float));
					this.objTable.Columns.Add(column);
					this.objTable.Columns.Add(column2);
					this.objTable.Columns.Add(column3);
					this.objTable.Columns.Add(column4);
					this.objTable.Columns.Add(column5);
					this.objTable.Columns.Add(column6);
					this.objTable.Columns.Add(column7);
					this.objTable.Columns.Add(column8);
					this.objTable.Columns.Add(column9);
					this.objTable.Columns.Add(column10);
					this.objTable.Columns.Add(column11);
					this.objTable.Columns.Add(column12);
					this.objTable.Columns.Add(column13);
					this.objTable.Columns.Add(column14);
					this.objTable.Columns.Add(column15);
					this.objTable.Columns.Add(column16);
					this.objTable.Columns.Add(column17);
					this.objTable.Columns.Add(column18);
					this.objTable.Columns.Add(column19);
					this.objTable.Columns.Add(column20);
					for (int i = 0; i < this.objProductTable.Rows.Count; i++)
					{
						this.getProductInformation(this.objProductTable.Rows[i]["ProductID"].ToString(), this.objProductTable.Rows[i]["ProductNumber"].ToString(), ref this.objTable);
					}
					this.totalMoney = string.Format(Program.lenAffterDecimal, this.checkMoneyOfBill());
					try
					{
						if (this.dgvProduct.Rows.Count == 0)
						{
							MessageBox.Show("Nhập thông tin chi tiết về đơn hàng trước khi lưu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
						}
						else
						{
							if (this.currCusID == "" && this.txtName.Text != "")
							{
								if (this.objCus.existsNameCustomerFree(this.txtName.Text))
								{
									if (MessageBox.Show("Khách hàng có tên " + this.txtName.Text.ToUpper() + " đã tồn tại trên hệ thống!\r\nNếu bạn muốn thêm tên này như một khách hàng mới, nhấn NO\r\n\r\n Nếu muốn chọn thông tin từ hệ thống, nhấn YES", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
									{
										this.btnFind.PerformClick();
									}
									return;
								}
							}
							if (this.txtAge.Text == "")
							{
								this.txtAge.Text = "0";
							}
							else
							{
								try
								{
									int num = int.Parse(this.txtAge.Text);
								}
								catch
								{
									MessageBox.Show("Tuổi của khách hàng phải là một số nguyên?", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
									return;
								}
							}
							if (!this.btnEdit.Enabled)
							{
								if (this.objBill.checkID("NEW"))
								{
									MessageBox.Show("Hoá đơn có số hiệu \"" + this.txtID.Text + "\" đã tồn tại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
									this.txtID.Focus();
									return;
								}
							}
							if (this.objBill.action("NEW", this.txtDate.Value, float.Parse(this.totalMoney.Replace(",", "")), "OUT4", this.cbbWareHouse.SelectedValue.ToString(), "", this.cusID, this.objTable, this.txtName.Text, int.Parse(this.txtAge.Text), this.cbbSex.SelectedIndex, this.txtAddress.Text, this.txtPhone.Text, "OUT4", this.userName, this.fullName, this.txtDoctor.Text, "", "", this.txtDoctorGuide.Text, this.currDortorID, this.currCusID, 0f, float.Parse(this.totalMoney)) == 1)
							{
								MessageBox.Show("Có lỗi xảy ra trong quá trình lưu hoá đơn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
								this.txtID.Focus();
							}
							else
							{
								if (this.txtID.Text.Trim() == "NEW")
								{
									this.txtID.Text = this.objBill.getNewestRetailID();
								}
								this.updateBillStatus();
								this.btnPrint.PerformClick();
							}
						}
					}
					catch
					{
						MessageBox.Show("Lỗi : - Việc lưu hoá đơn không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
					}
				}
				catch (Exception ex)
				{
					MessageBox.Show(ex.Message);
				}
			}
		}
		private void updateBillStatus()
		{
			try
			{
				if (this.txtID.Text != "")
				{
					SqlConnection sqlConnection = new SqlConnection(this.objFunc.strConnectionString);
					SqlCommand sqlCommand = new SqlCommand("UPDATE TabPrescription SET Status = 1 WHERE [ID] = '" + this.txtID + "'", sqlConnection);
					sqlConnection.Open();
					sqlCommand.ExecuteNonQuery();
					SqlCommand sqlCommand2 = new SqlCommand(string.Concat(new object[]
					{
						"UPDATE TabPrescription SET billID = '",
						this.txtID.Text,
						"' WHERE [ID] = '",
						this.txtID,
						"'"
					}), sqlConnection);
					sqlCommand2.ExecuteNonQuery();
					SqlCommand sqlCommand3 = new SqlCommand("UPDATE TabPrescriptionDetail SET ProductNumberSale = 0 WHERE [billID] = '" + this.txtID + "'", sqlConnection);
					sqlCommand3.ExecuteNonQuery();
					sqlConnection.Close();
					sqlConnection.Dispose();
					for (int i = 0; i < this.objTable.Rows.Count; i++)
					{
						this.updateBillNumber(this.txtID.Text, this.objTable.Rows[i]["Pid"].ToString(), this.objTable.Rows[i]["ProductNumber"].ToString());
					}
				}
			}
			catch
			{
			}
		}
		private void updateBillNumber(string billIID, string pid, string productNumber)
		{
			try
			{
				SqlConnection sqlConnection = new SqlConnection(this.objFunc.strConnectionString);
				SqlCommand sqlCommand = new SqlCommand(string.Concat(new object[]
				{
					"UPDATE TabPrescriptionDetail SET ProductNumberSale = productNumber WHERE [billID] = '",
					this.txtID,
					"' AND ProductID = ",
					pid
				}), sqlConnection);
				sqlConnection.Open();
				sqlCommand.ExecuteNonQuery();
				sqlConnection.Close();
				sqlConnection.Dispose();
			}
			catch
			{
			}
		}
		private void getProductInformation(string productID, string number, ref DataTable objTable)
		{
			try
			{
				SqlConnection sqlConnection = new SqlConnection(this.objFunc.strConnectionString);
				sqlConnection.Open();
				SqlCommand sqlCommand = sqlConnection.CreateCommand();
				sqlCommand.CommandText = string.Concat(new string[]
				{
					"SELECT TOP 1 TabDetailBill.Pid, TabDetailBill.ProductName, TabDetailBill.ProductUnit, TabDetailBill.ProductPrice, TabDetailBill.ProductPrice2, TabDetailBill.Packet, TabDetailBill.ProductDate, TabDetailBill.ProductExpiryDate, TabDetailBill.ProductPrice1, TabDetailBill.NationalID, TabDetailBill.VAT,TabDetailBill.VATasMoney, TabDetailBill.PossName, TabDetailBill.Rate, TabBill.CreateDate FROM TabDetailBill,TabBill WHERE TabDetailBill.billID = TabBill.Id AND TypeInput IN('IN1','IN2','IN3') AND Packet IN (SELECT Packet FROM TabTotalBalancer WHERE  productNumberOut < productNumberIn AND [Pid] = ",
					productID,
					") AND TabDetailBill.Pid = ",
					productID,
					" ORDER BY TabBill.CreateDate"
				});
				SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
				while (sqlDataReader.Read())
				{
					this.objTable.Rows.Add(new object[]
					{
						sqlDataReader["Pid"].ToString(),
						sqlDataReader["ProductName"].ToString(),
						sqlDataReader["ProductUnit"].ToString(),
						string.Format(Program.lenAffterDecimal, double.Parse(number)),
						string.Format(Program.lenAffterDecimal, double.Parse(sqlDataReader["ProductPrice"].ToString())),
						string.Format(Program.lenAffterDecimal, double.Parse(number) * double.Parse(sqlDataReader["ProductPrice2"].ToString())),
						sqlDataReader["Packet"].ToString(),
						sqlDataReader["ProductDate"].ToString(),
						sqlDataReader["ProductExpiryDate"].ToString(),
						string.Format(Program.lenAffterDecimal, double.Parse(sqlDataReader["ProductPrice1"].ToString())),
						string.Format(Program.lenAffterDecimal, double.Parse(sqlDataReader["ProductPrice2"].ToString())),
						sqlDataReader["NationalID"].ToString(),
						sqlDataReader["VAT"].ToString(),
						sqlDataReader["PossName"],
						sqlDataReader["Rate"].ToString(),
						"",
						"",
						"",
						"",
						sqlDataReader["VATAsMoney"].ToString()
					});
				}
				sqlConnection.Close();
				sqlConnection.Dispose();
			}
			catch
			{
			}
		}
		private double checkMoneyOfBill()
		{
			double num = 0.0;
			for (int i = 0; i < this.objTable.Rows.Count; i++)
			{
				num += double.Parse(this.objTable.Rows[i]["ProductMoney"].ToString());
			}
			return num;
		}
		private void txtProductNumber1_TextChanged(object sender, EventArgs e)
		{
			try
			{
				double num = double.Parse(this.txtProductNumber1.Text) * double.Parse(this.txtProductPrice.Text);
				this.txtProductMoney.Text = string.Format(Program.lenAffterDecimal, num);
			}
			catch
			{
			}
		}
		private void txtDesease_DoubleClick(object sender, EventArgs e)
		{
			if (this.btnSave.Enabled)
			{
				this.btnTmp.PerformClick();
			}
		}
		private void txtName_DoubleClick(object sender, EventArgs e)
		{
			if (this.btnSave.Enabled)
			{
				this.btnFind.Enabled = true;
				this.btnFind.PerformClick();
			}
		}
	}
}
